blob: b933eb2212326aac8592f3a973aa437e8462479f [file] [log] [blame] [view]
Marcel van Lohuizen75cb0032019-01-11 12:10:48 +01001[TOC](Readme.md) [Prev](fold.md) [Next](comments.md)
2
Marcel van Lohuizenaf0932f2019-01-11 13:03:56 +01003_JSON Sugar and other Goodness_
4
Marcel van Lohuizen75cb0032019-01-11 12:10:48 +01005# Folding all Fields
6
7This also works if a struct has more than one member.
8
Marcel van Lohuizen3e592b42019-01-11 20:31:29 +01009In general, any JSON object can be expressed as a collection of
Marcel van Lohuizen75cb0032019-01-11 12:10:48 +010010path-leaf pairs without using any curly braces.
11
12<!-- CUE editor -->
13```
14outer middle1 inner: 3
15outer middle2 inner: 7
16```
17
18<!-- JSON result -->
19```json
Marcel van Lohuizene8992502019-01-11 13:10:54 +010020{
21 "outer": {
22 "middle1": {
23 "inner": 3
24 },
25 "middle2": {
26 "inner": 7
27 }
Marcel van Lohuizen75cb0032019-01-11 12:10:48 +010028 }
29}
30```