jsonutils.toJson now serializes JsonNode as is by default (#18097)

* jsonutils.toJson now serializes JsonNode as is (without deep copy nor treating it as a regular ref object)

* JsonNodeMode
This commit is contained in:
Timothee Cour 2021-05-31 13:17:52 -07:00 • committed by GitHub
commit 369a7d1246
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 41 additions and 5 deletions

View file

@ -69,7 +69,9 @@
previous behavior for a transition time, see PR #17467.
- `jsonutils` now serializes/deserializes holey enums as regular enums (via `ord`) instead of as strings.
Use `-d:nimLegacyJsonutilsHoleyEnum` for a transition period.
Use `-d:nimLegacyJsonutilsHoleyEnum` for a transition period. `toJson` now serializes `JsonNode`
as is via reference (without a deep copy) instead of treating `JsonNode` as a regular ref object,
this can be customized via `jsonNodeMode`.
- `json` and `jsonutils` now serialize NaN, Inf, -Inf as strings, so that
`%[NaN, -Inf]` is the string `["nan","-inf"]` instead of `[nan,-inf]` which was invalid json.