Module

Data.Codec.Argonaut.Migration

Package
purescript-codec-argonaut
Repository
garyb/purescript-codec-argonaut

#addDefaultField Source

addDefaultField :: String -> Json -> JsonCodec Json

When dealing with a JSON object that may be missing a field, this codec can be used to alter the JSON before parsing to ensure a default value is present instead.

#updateField Source

updateField :: String -> (Json -> Json) -> JsonCodec Json

Re-maps the value of a field in a JSON object.

#addDefaultOrUpdateField Source

addDefaultOrUpdateField :: String -> (Maybe Json -> Json) -> JsonCodec Json

When dealing with a JSON object that may be missing a field, this codec can be used to alter the JSON before parsing to ensure a default value is present instead. Similar to addDefaultField, but allows existing values to be modified also.

#renameField Source

renameField :: String -> String -> JsonCodec Json

When dealing with a JSON object that has had a field name changed, this codec can be used to alter the JSON before parsing to ensure the new field name is used instead