json-syntax-0.2.7.2: High-performance JSON parser and encoder
Safe HaskellSafe-Inferred
LanguageHaskell2010

Json.Flatten

Description

Flatten nested JSON objects into a single JSON object in which the keys have been joined by the separator.

Synopsis

Documentation

flatten :: Char -> Value -> Value Source #

Flatten a json value, recursively descending into objects and joining keys with the separator. For example:

{ "name": "bilbo"
, "occupation":
  { "name": "burglar"
  , "start": "2022-05-30"
  }
, "height": 124
, "favorites": ["adventures","lunch"]
}

Becomes:

{ "name": "bilbo"
, "occupation.name": "burglar"
, "occupation.start": "2022-05-30"
, "height": 124
, "favorites": ["adventures","lunch"]
}

Currently, the implementation of this function throws an exception if any separator other than period is used. This may be corrected in a future release.