Skip to content

Commit a91a8cc

Browse files
committed
Improving docs
1 parent 6dfef71 commit a91a8cc

File tree

4 files changed

+10
-12
lines changed

4 files changed

+10
-12
lines changed

pkg/yqlib/doc/operators/encode-decode.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ These operators are useful to process yaml documents that have stringified embed
99

1010
| Format | Decode (from string) | Encode (to string) |
1111
| --- | -- | --|
12-
| Yaml | from_yaml | to_yaml(i)/@yaml |
13-
| JSON | from_json | to_json(i)/@json |
12+
| Yaml | from_yaml/@yamld | to_yaml(i)/@yaml |
13+
| JSON | from_json/@jsond | to_json(i)/@json |
1414
| Properties | from_props/@propsd | to_props/@props |
1515
| CSV | from_csv/@csvd | to_csv/@csv |
1616
| TSV | from_tsv/@tsvd | to_tsv/@tsv |
17-
| XML | from_xml | to_xml(i)/@xml |
17+
| XML | from_xml/@xmld | to_xml(i)/@xml |
1818
| Base64 | @base64d | @base64 |
1919

2020

pkg/yqlib/doc/operators/headers/encode-decode.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ These operators are useful to process yaml documents that have stringified embed
99

1010
| Format | Decode (from string) | Encode (to string) |
1111
| --- | -- | --|
12-
| Yaml | from_yaml | to_yaml(i)/@yaml |
13-
| JSON | from_json | to_json(i)/@json |
12+
| Yaml | from_yaml/@yamld | to_yaml(i)/@yaml |
13+
| JSON | from_json/@jsond | to_json(i)/@json |
1414
| Properties | from_props/@propsd | to_props/@props |
1515
| CSV | from_csv/@csvd | to_csv/@csv |
1616
| TSV | from_tsv/@tsvd | to_tsv/@tsv |
17-
| XML | from_xml | to_xml(i)/@xml |
17+
| XML | from_xml/@xmld | to_xml(i)/@xml |
1818
| Base64 | @base64d | @base64 |
1919

2020

pkg/yqlib/doc/usage/convert.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
# JSON
22

3-
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.
3+
Encode and decode to and from JSON. Supports multiple JSON documents in a single file (e.g. NDJSON).
44

5-
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`.
5+
Note that YAML is a superset of (single document) JSON - so you don't have to use the JSON parser to read JSON when there is only one JSON document in the input. You will probably want to pretty print the result in this case, to get idiomatic YAML styling.
66

7-
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.
87

98
{% hint style="warning" %}
109
Note that versions prior to 4.18 require the 'eval/e' command to be specified. 
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# JSON
22

3-
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.
3+
Encode and decode to and from JSON. Supports multiple JSON documents in a single file (e.g. NDJSON).
44

5-
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`.
5+
Note that YAML is a superset of (single document) JSON - so you don't have to use the JSON parser to read JSON when there is only one JSON document in the input. You will probably want to pretty print the result in this case, to get idiomatic YAML styling.
66

7-
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.

0 commit comments

Comments
 (0)