Added NDJSON decoder (#1281)

This commit is contained in:
Mike Farah
2022-07-27 12:26:22 +10:00
committed by GitHub
parent c2c48bbe1d
commit b9a1ef89fe
13 changed files with 425 additions and 15 deletions
+3 -1
View File
@@ -1,5 +1,7 @@
# JSON
Encode and decode to and from JSON. Note that YAML is a _superset_ of JSON - so `yq` can read any json file without doing anything special.
Encode and decode to and from JSON. Note that, unless you have multiple JSON documents in a single file, YAML is a _superset_ of JSON - so `yq` can read any json file without doing anything special.
If you do have mulitple JSON documents in a single file (e.g. NDJSON) then you will need to explicity use the json parser `-p=json`.
This means you don't need to 'convert' a JSON file to YAML - however if you want idiomatic YAML styling, then you can use the `-P/--prettyPrint` flag, see examples below.