Commit Graph

14 Commits

Author SHA1 Message Date
Mike Farah
13d1bbb45f
Generic ast (#1829)
Remove dependency on yaml.Node for internal AST representation. Yaml decoder is now just another decoder.
2023-10-18 12:11:53 +11:00
Anders Björklund
cf8cfbd865
Allow build without json and xml support (#1556)
* Refactor ordered_map into separate files

Separate json and xml, from the regular yaml.

Makes it possible to compile, without those...

* Refactor encoder and decoder creation

Use more consistent parameters vs globals

Return errors instead of calling panic()

* Allow build without json and xml support
2023-03-01 13:19:06 +11:00
Mike Farah
1d35134310 Unwrap scalar now works for JSON encoding when explicitly set #1409 2022-11-10 19:21:18 +11:00
Mike Farah
880397d549
Refactored decoder responsibilities (#1402)
- improved comment handling
- yaml decoder now responsible for leading content work around
2022-10-28 14:16:46 +11:00
Mike Farah
b9a1ef89fe
Added NDJSON decoder (#1281) 2022-07-27 12:26:22 +10:00
Mike Farah
fbe49c3700 Added colors to json output #1208 2022-05-22 21:19:59 +10:00
Mike Farah
26356ff4be Added github action fix for parsing xml, updated linter 2022-02-07 11:55:55 +11:00
Mike Farah
ec8ef312ef
Added XML encoding/decoding (#1067)
* Added XML encoding/decoding

* Minor fixes

* Improve yq doc

* Lint
2022-01-15 11:57:59 +11:00
Mike Farah
df32baedf1
Added XML decoder (#1044) 2021-12-21 15:02:07 +11:00
Mike Farah
08fc058934 Fix JSON encoding removing null #985 2021-10-30 13:37:21 +11:00
evnp
1be3b31bbc Don't escape HTML chars when converting to json
json.Encoder and json.Marshal implicitly use HTMLEscape to convert
>, <, &, with \u003c, \u003e, \u0026. This behavior carries over
to yq, where chars will be escaped when outputting json but not when
outputting yaml.

This changeset disables this behavior via encoder.SetEscapeHTML(false).
Unfortunately there is no equivalent option for json.Marshal, so its
single usage has been replaced with an encoder (with escaping disabled).
2021-02-11 10:58:40 +11:00
Mike Farah
d38caf6bc2 Added File operators 2020-11-20 22:57:32 +11:00
Mike Farah
9bd9468526 Minor fixes 2020-11-19 22:11:26 +11:00
Mike Farah
83cb6421df added test to ensure json keys remain in order 2020-11-17 16:17:38 +11:00