plutus-tx-1.30.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.

optionalField ∷ ToJSON a ⇒ Key → Maybe a → Object → Object Source #

requiredField ∷ ToJSON 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"