Skip to content

Include context arg in reviver calls + serialize raw JSON values - #726

Merged
eemeli merged 2 commits into
mainfrom
raw-json
Sep 23, 2026
Merged

eemeli merged 2 commits into
mainfrom
raw-json

Conversation

@eemeli

@eemeli eemeli commented Sep 22, 2026

Copy link
Copy Markdown
Owner

Adds support for the new reviver & JSON.rawJSON capabilities that were added to JS in ECMAScript 2026 by the JSON.parse source text access proposal.

When using parse() or doc.toJS(), if a reviver is specified, it will be called with a third argument (in addition to key and value): a context object which contains a source string value for scalar values. Note that the source is the unescaped and unfolded string value, not the raw YAML source.

Correspondingly, during serialization, values returned by JSON.rawJSON() are effectively handled as strings, and so should "just work".

@eemeli eemeli changed the title Raw json Include context arg in reviver calls + serialize raw JSON values Sep 23, 2026
@eemeli
eemeli merged commit 528ef30 into main Sep 23, 2026
20 checks passed
@eemeli
eemeli deleted the raw-json branch September 23, 2026 00:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant