diff --git a/c/cli/mlrcli.c b/c/cli/mlrcli.c index 3c5ea649d..79c170022 100644 --- a/c/cli/mlrcli.c +++ b/c/cli/mlrcli.c @@ -283,6 +283,22 @@ static void main_usage_data_format_examples(FILE* o, char* argv0) { " | 4,5,6 | Record 2: \"apple\" => \"4\", \"bat\" => \"5\", \"cog\" => \"6\"\n" " +---------------------+\n" "\n" + " Tabular JSON: nested objects are supported, but arrays within them are not:\n" + " +---------------------+\n" + " | { |\n" + " | \"apple\": 1, | Record 1: \"apple\" => \"1\", \"bat\" => \"2\", \"cog\" => \"3\"\n" + " | \"bat\": 2, |\n" + " | \"cog\": 3 |\n" + " | } |\n" + " | { |\n" + " | \"dish\": { | Record 2: \"dish:egg\" => \"7\", \"dish:flint\" => \"8\", \"garlic\" => \"\"\n" + " | \"egg\": 7, |\n" + " | \"flint\": 8 |\n" + " | }, |\n" + " | \"garlic\": \"\" |\n" + " | } |\n" + " +---------------------+\n" + "\n" " PPRINT: pretty-printed tabular\n" " +---------------------+\n" " | apple bat cog |\n" diff --git a/c/todo.txt b/c/todo.txt index f01ee79b4..4aa55cd79 100644 --- a/c/todo.txt +++ b/c/todo.txt @@ -63,7 +63,8 @@ TOP-OF-LIST DETAILS * JSON I/O: ! string-preservation for doubles ! ! UT ! - ! mlr --json reshape -i x,y -o item,value rec.json + > mlr --json reshape -i x,y -o item,value rec.json + ! mld x several; also mlr -h output example o wishlist: streamable version with fgetc rather than pointer-math. - on output, check 1st if mlhmmv is necessary? or just always? diff --git a/doc/file-formats.html b/doc/file-formats.html index cf3ab6918..e11f719d0 100644 --- a/doc/file-formats.html +++ b/doc/file-formats.html @@ -169,6 +169,22 @@ $ mlr --usage-data-format-examples | 4,5,6 | Record 2: "apple" => "4", "bat" => "5", "cog" => "6" +---------------------+ + Tabular JSON: nested objects are supported, but arrays within them are not: + +---------------------+ + | { | + | "apple": 1, | Record 1: "apple" => "1", "bat" => "2", "cog" => "3" + | "bat": 2, | + | "cog": 3 | + | } | + | { | + | "dish": { | Record 2: "dish:egg" => "7", "dish:flint" => "8", "garlic" => "" + | "egg": 7, | + | "flint": 8 | + | }, | + | "garlic": "" | + | } | + +---------------------+ + PPRINT: pretty-printed tabular +---------------------+ | apple bat cog | diff --git a/doc/mlr.1.premade b/doc/mlr.1.premade index fa905e0be..1f3cc0577 100644 --- a/doc/mlr.1.premade +++ b/doc/mlr.1.premade @@ -83,6 +83,22 @@ mlr stats2 -a linreg-pca -f u,v -g shape data/* | 4,5,6 | Record 2: "apple" => "4", "bat" => "5", "cog" => "6" +---------------------+ + Tabular JSON: nested objects are supported, but arrays within them are not: + +---------------------+ + | { | + | "apple": 1, | Record 1: "apple" => "1", "bat" => "2", "cog" => "3" + | "bat": 2, | + | "cog": 3 | + | } | + | { | + | "dish": { | Record 2: "dish:egg" => "7", "dish:flint" => "8", "garlic" => "" + | "egg": 7, | + | "flint": 8 | + | }, | + | "garlic": "" | + | } | + +---------------------+ + PPRINT: pretty-printed tabular +---------------------+ | apple bat cog | diff --git a/doc/reference.html b/doc/reference.html index b4d6ab218..3de453b78 100644 --- a/doc/reference.html +++ b/doc/reference.html @@ -322,6 +322,22 @@ Data-format examples: | 4,5,6 | Record 2: "apple" => "4", "bat" => "5", "cog" => "6" +---------------------+ + Tabular JSON: nested objects are supported, but arrays within them are not: + +---------------------+ + | { | + | "apple": 1, | Record 1: "apple" => "1", "bat" => "2", "cog" => "3" + | "bat": 2, | + | "cog": 3 | + | } | + | { | + | "dish": { | Record 2: "dish:egg" => "7", "dish:flint" => "8", "garlic" => "" + | "egg": 7, | + | "flint": 8 | + | }, | + | "garlic": "" | + | } | + +---------------------+ + PPRINT: pretty-printed tabular +---------------------+ | apple bat cog |