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:
|
testIt(t, "FmtConciseA", "fmt", "--concise", "-i", "FmtConciseA.json") |
Will gives the result of:
|
[ |
|
{"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.
The
jsonfiddle fmt's-s, --conciseoption willSo, what is the "concise array style"?
The
jsonfiddle fmt's-s, --conciseoption 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 fmtcommand of:jsonfiddle/jsonfiddle_test.go
Line 72 in f69acaf
Will gives the result of:
jsonfiddle/test/FmtConciseA.ref
Lines 1 to 5 in f69acaf
This format allows me to use simple tool like
grepto search all records of, say, the LA city.