json-output iterate

This commit is contained in:
John Kerl 2016-01-30 14:09:46 -05:00
parent 050270446b
commit 2395dbecb9
5 changed files with 106 additions and 0 deletions

View file

@ -14155,3 +14155,91 @@ x 0.676537984365847889
a zee
i 4
================================================================
JSON OUTPUT
mlr --ojson cat ./reg_test/input/json-output-options.dkvp
{ "a": 1, "b": "x", "c": 3 }
{ "d": 4 }
{ "e": 5, "f": 6 }
mlr --ojson --jvtemp cat ./reg_test/input/json-output-options.dkvp
{
"a": 1,
"b": "x",
"c": 3
}
{
"d": 4
}
{
"e": 5,
"f": 6
}
mlr --ojson --jotemp cat ./reg_test/input/json-output-options.dkvp
[
{ "a": 1, "b": "x", "c": 3 }
,{ "d": 4 }
,{ "e": 5, "f": 6 }
]
mlr --ojson --jvtemp --jotemp cat ./reg_test/input/json-output-options.dkvp
[
{
"a": 1,
"b": "x",
"c": 3
}
,{
"d": 4
}
,{
"e": 5,
"f": 6
}
]
mlr --ojson --jqtemp cat ./reg_test/input/json-output-options.dkvp
{ "a": "1", "b": "x", "c": "3" }
{ "d": "4" }
{ "e": "5", "f": "6" }
mlr --ojson --jvtemp --jqtemp cat ./reg_test/input/json-output-options.dkvp
{
"a": "1",
"b": "x",
"c": "3"
}
{
"d": "4"
}
{
"e": "5",
"f": "6"
}
mlr --ojson --jotemp --jqtemp cat ./reg_test/input/json-output-options.dkvp
[
{ "a": "1", "b": "x", "c": "3" }
,{ "d": "4" }
,{ "e": "5", "f": "6" }
]
mlr --ojson --jvtemp --jotemp --jqtemp cat ./reg_test/input/json-output-options.dkvp
[
{
"a": "1",
"b": "x",
"c": "3"
}
,{
"d": "4"
}
,{
"e": "5",
"f": "6"
}
]

View file

@ -69,6 +69,7 @@ EXTRA_DIST= \
join-het.dkvp \
joina.dkvp \
joinb.dkvp \
json-output-options.dkvp \
logi.dkvp \
merge-fields-abxy.dkvp \
merge-fields-in-out.csv \

View file

@ -0,0 +1,3 @@
a=1,b=x,c=3
d=4
e=5,f=6

View file

@ -1441,6 +1441,18 @@ announce MULTI-CHARACTER IXS SPECIFIERS
run_mlr --oxtab --idkvp --mmap --irs lf --ifs '\x2c' --ips '\075' cut -o -f x,a,i $indir/multi-sep.dkvp
run_mlr --oxtab --idkvp --mmap --irs lf --ifs /, --ips '\x3d\x3a' cut -o -f x,a,i $indir/multi-sep.dkvp
# ================================================================
announce JSON OUTPUT
run_mlr --ojson cat $indir/json-output-options.dkvp
run_mlr --ojson --jvtemp cat $indir/json-output-options.dkvp
run_mlr --ojson --jotemp cat $indir/json-output-options.dkvp
run_mlr --ojson --jvtemp --jotemp cat $indir/json-output-options.dkvp
run_mlr --ojson --jqtemp cat $indir/json-output-options.dkvp
run_mlr --ojson --jvtemp --jqtemp cat $indir/json-output-options.dkvp
run_mlr --ojson --jotemp --jqtemp cat $indir/json-output-options.dkvp
run_mlr --ojson --jvtemp --jotemp --jqtemp cat $indir/json-output-options.dkvp
# ================================================================
# A key feature of this regression script is that it can be invoked from any
# directory. Depending on the directory it's invoked from, the path to $outdir

View file

@ -11,6 +11,7 @@ TOP OF LIST
* json output x 2
* tabular-json input
* spec & impl for multilevel emit
* bare-boolean with block
----------------------------------------------------------------
* \0 example into mld:ref:regex
@ -39,6 +40,7 @@ TOP OF LIST
* JSON I/O:
- input: https://github.com/udp/json-parser ? ; http://www.json.org/ C section
- output: mlr-native json output is trivial & just do it.
! turn the iffing into precomputed separtor strings
- cover x 2
- define 'tabular JSON' by example @ mld