| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Json.Flatten
Description
Flatten nested JSON objects into a single JSON object in which the keys have been joined by the separator.
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.