Skip to content

Commit

Permalink
docs(readme): note we treat JSON objs as ordered
Browse files Browse the repository at this point in the history
  • Loading branch information
dbohdan committed Nov 9, 2020
1 parent a14848b commit cb90030
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,9 @@ Option example: `format=json kv=false`

Parse the input as JSON or [JSON Lines](https://jsonlines.org/). The value for `kv` and `lines` can be `0`/`false`/`no`/`off` or `1`/`true`/`yes`/`on`. If `lines` is false, the input is treated as a JSON array of either objects (`kv=1`) or arrays (`kv=0`). If `lines` is true, the input is treated as a text file with a JSON array or object (depending on `kv`) on every line.

When `kv` is false, each array becomes a record and each of its elements a field. If the table for the input file is `a`, its column `a0` contains the concatenation of every element of the array, `a1` contains the first element, `a2` the second element, and so on. When `kv` is true, the first record contains every unique key found in all of the objects. This is intended for use with the [file option](#per-file-options) `header=1`. The keys are in the same order they are in the first object of the input. If some keys aren't in the first object but are in subsequent objects, they follow those that are in the first object in alphabetical order. Records from the second on contain the values of the input objects. These values are mapped to fields according to the order of the keys in the first record.
When `kv` is false, each array becomes a record and each of its elements a field. If the table for the input file is `a`, its column `a0` contains the concatenation of every element of the array, `a1` contains the first element, `a2` the second element, and so on. When `kv` is true, the first record contains every unique key found in all of the objects. This is intended for use with the [file option](#per-file-options) `header=1`. The keys are in the same order they are in the first object of the input. (We treat JSON objects as ordered.) If some keys aren't in the first object but are in subsequent objects, they follow those that are in the first object in alphabetical order. Records from the second on contain the values of the input objects. These values are mapped to fields according to the order of the keys in the first record.

Every value in an object or an array is converted to text when parsed. JSON given to Sqawk should only have one level of nesting (`[[],[],[]]` or `[{},{},{}]`). What happens with more deeply nested JSON undefined. Currently it is converted to text as Tcl dictionaries and lists.
Every value in an object or an array is converted to text when parsed. JSON given to Sqawk should only have one level of nesting (`[[],[],[]]` or `[{},{},{}]`). What happens with more deeply nested JSON is undefined. Currently it is converted to text as Tcl dictionaries and lists.

#### tcl

Expand Down

0 comments on commit cb90030

Please sign in to comment.