mirror of
https://github.com/Start9Labs/registry.git
synced 2026-04-04 21:59:43 +00:00
another deserialization fix
This commit is contained in:
@@ -107,10 +107,11 @@ instance ToJSON PackageDevice where
|
|||||||
toKeyValue (key, value) = fromText key .= toJSON value
|
toKeyValue (key, value) = fromText key .= toJSON value
|
||||||
instance FromJSON PackageDevice where
|
instance FromJSON PackageDevice where
|
||||||
parseJSON = withObject "PackageDevice" $ \obj -> do
|
parseJSON = withObject "PackageDevice" $ \obj -> do
|
||||||
hashMap <- parseJSON (Object obj)
|
hashMap <- obj .: ""
|
||||||
pure $ PackageDevice hashMap
|
pure $ PackageDevice hashMap
|
||||||
|
|
||||||
instance PersistField PackageDevice where
|
instance PersistField PackageDevice where
|
||||||
|
toPersistValue :: PackageDevice -> PersistValue
|
||||||
toPersistValue = PersistText . T.pack . show . toJSON
|
toPersistValue = PersistText . T.pack . show . toJSON
|
||||||
fromPersistValue (PersistText t) = case eitherDecodeStrict (TE.encodeUtf8 t) of
|
fromPersistValue (PersistText t) = case eitherDecodeStrict (TE.encodeUtf8 t) of
|
||||||
Left err -> Left $ T.pack err
|
Left err -> Left $ T.pack err
|
||||||
|
|||||||
Reference in New Issue
Block a user