plutus-tx-1.36.0.0: Libraries for Plutus Tx and its prelude
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Aeson.Extra

Synopsis

Documentation

buildObject ∷ (Object → Object) → Value Source #

Build a JSON object omitting optional keys if a corresponding value is Nothing.

Example: buildObject $ requiredField "field1" a . requiredField "field2" c . optionalField "field3" (Just "hello") . optionalField "field4" Nothing builds this JSON object: { "field1": a, "field2": c, "field3": "hello" } omitting optional field4.

optionalFieldToJSON a ⇒ Key → Maybe a → Object → Object Source #

requiredFieldToJSON a ⇒ Key → a → Object → Object Source #

stripPrefix Source #

Arguments

String

Field prefix to strip

String

Field name

String 

A field label modifier that strips a prefix from the camelCased field name; >>> stripPrefix "preamble" "preambleTitle" "title"