aeson-flatten-0.1.0.1: JSON flatten for Aeson

MaintainerJiri Marsicek <jiri.marsicek@gmail.com>
Safe HaskellNone
LanguageHaskell2010

Data.Aeson.Flatten

Contents

Description

Module provides flatten which is used to flatten structure of Aeson JSON Value as much as possible.

Examples

Basic objects

{ "a": { "b": 1 } } results in { "b": 1 }

{ "a": { "b": { "c": 1 } } } results in { "c": 1 }

{ "a": [ { "b": { "c": 1 } }, { "b": { "c": 2 } } ] } results in { "a": [ { "c": 1 }, { "c": 2 } ] }

Name conflicts result in data loss

{ "a": 1, "b": { "a": 2 } } results in { "a": 1 }

  • I don't know yet whether this is a feature or a bug :)

Synopsis

Documentation

flatten :: Value -> Value Source

Recursively Flattens the structure of the provided JSON Value

Utility functions

isObject :: Value -> Bool Source

Predicate for testing whether provided Value is a Object.

mergeTo :: Value -> Value -> Value Source

Merges keys from second Value to first Value. In case of name conflict, values from first are preserved.