diff --git a/c/reg_test/expected/out b/c/reg_test/expected/out index 27a48fa1c..821e6a774 100644 --- a/c/reg_test/expected/out +++ b/c/reg_test/expected/out @@ -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" +} +] + diff --git a/c/reg_test/input/Makefile.am b/c/reg_test/input/Makefile.am index e3ac6d9e7..8da90b900 100644 --- a/c/reg_test/input/Makefile.am +++ b/c/reg_test/input/Makefile.am @@ -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 \ diff --git a/c/reg_test/input/json-output-options.dkvp b/c/reg_test/input/json-output-options.dkvp new file mode 100644 index 000000000..e7679fe08 --- /dev/null +++ b/c/reg_test/input/json-output-options.dkvp @@ -0,0 +1,3 @@ +a=1,b=x,c=3 +d=4 +e=5,f=6 diff --git a/c/reg_test/run b/c/reg_test/run index 69e09e814..75b1556b5 100755 --- a/c/reg_test/run +++ b/c/reg_test/run @@ -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 diff --git a/c/todo.txt b/c/todo.txt index 54a15bd13..5d972a493 100644 --- a/c/todo.txt +++ b/c/todo.txt @@ -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