Some functions to deal with json data.
Turn raw json into a fully developed object defined in terms of Dictionary, Lst and primitives.
str = "{ \"banker\": { \"name\": \"Alice\" }, \"fireman\": { \"age\": 42 } }"
boxed = decodeString decoder str |> Result.withDefault Null
expand boxed == Dictionary (Dict.fromList [("banker",Dictionary (Dict.fromList [("name",Str "Alice")])),("fireman",Dictionary (Dict.fromList [("age",Integer 42)]))])Handy encoder for the Boxed type. It only encodes primitives, Dictionary
and Lst. If it encouters a Tup or a Custom, it will render them null.
Handy decoder for the
Boxedtype. It does not decode tuples or custom values. It will only decode dictionaries at top level if they are only one level deep and its values are all primitives. Same with lists. Composite objects deeper than that will be stored as Json.