-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
Description
The jsonfiddle fmt's -s, --concise option will
Compact the top level array into concise array style
So, what is the "concise array style"?
The jsonfiddle fmt's -s, --concise option will compact the top level array onto one line while each one is still on a separated line, like this:
{
"the_root": [
{"id":101,"name":"Alpha","data":"Some value 1"},
{"id":202,"name":"Beta","data":"Another value 2"},
{"id":303,"name":"Gamma","data":"Third value 3"}
]
}with or without the top "the_root" level, this is called the concise array style in this program.
In concrete example, the jsonfiddle fmt command of:
Line 72 in f69acaf
| testIt(t, "FmtConciseA", "fmt", "--concise", "-i", "FmtConciseA.json") |
Will gives the result of:
jsonfiddle/test/FmtConciseA.ref
Lines 1 to 5 in f69acaf
| [ | |
| {"city":"NYC","name":"Alice"}, | |
| {"city":"LA","name":"Bob"}, | |
| {"city":"SF","name":"Charlie"} | |
| ] |
This format allows me to use simple tool like grep to search all records of, say, the LA city.