TOC Prev Next

JSON Sugar and other Goodness

Folding all Fields

This also works if a struct has more than one member.

In general, any JSON object can be expressed as a collection of path-leaf pairs without using any curly braces.

foldany.cue:

outer middle1 inner: 3
outer middle2 inner: 7

$ cue export foldany.cue

{
    "outer": {
        "middle1": {
            "inner": 3
        },
        "middle2": {
            "inner": 7
        }
    }
}