You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pkg/yqlib/doc/usage/convert.md
+3-5Lines changed: 3 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -125,9 +125,7 @@ will output
125
125
{"whatever":"cat"}
126
126
```
127
127
128
-
## Roundtrip NDJSON
129
-
Unfortunately the json encoder strips leading spaces of values.
130
-
128
+
## Roundtrip JSON Lines / NDJSON
131
129
Given a sample.json file of:
132
130
```json
133
131
{"this": "is a multidoc json file"}
@@ -147,7 +145,7 @@ will output
147
145
```
148
146
149
147
## Roundtrip multi-document JSON
150
-
The NDJSON parser can also handle multiple multi-line json documents in a single file!
148
+
The parser can also handle multiple multi-line json documents in a single file (despite this not being in the JSON Lines / NDJSON spec). Typically you would have one entire JSON document per line, but the parser also supports multiple multi-line json documents
Copy file name to clipboardExpand all lines: pkg/yqlib/json_test.go
+7-8Lines changed: 7 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -216,15 +216,14 @@ var jsonScenarios = []formatScenario{
216
216
scenarioType: "encode",
217
217
},
218
218
{
219
-
description: "Roundtrip NDJSON",
220
-
subdescription: "Unfortunately the json encoder strips leading spaces of values.",
221
-
input: sampleNdJson,
222
-
expected: expectedRoundTripSampleNdJson,
223
-
scenarioType: "roundtrip-ndjson",
219
+
description: "Roundtrip JSON Lines / NDJSON",
220
+
input: sampleNdJson,
221
+
expected: expectedRoundTripSampleNdJson,
222
+
scenarioType: "roundtrip-ndjson",
224
223
},
225
224
{
226
225
description: "Roundtrip multi-document JSON",
227
-
subdescription: "The NDJSON parser can also handle multiple multi-line json documents in a single file!",
226
+
subdescription: "The parser can also handle multiple multi-line json documents in a single file (despite this not being in the JSON Lines / NDJSON spec). Typically you would have one entire JSON document per line, but the parser also supports multiple multi-line json documents",
228
227
input: sampleMultiLineJson,
229
228
expected: roundTripMultiLineJson,
230
229
scenarioType: "roundtrip-multi",
@@ -246,13 +245,13 @@ var jsonScenarios = []formatScenario{
0 commit comments