Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for a partial parse #273

Open
eike opened this issue Oct 10, 2023 · 0 comments
Open

Allow for a partial parse #273

eike opened this issue Oct 10, 2023 · 0 comments

Comments

@eike
Copy link

eike commented Oct 10, 2023

It would be great if there were a way to partially parse a JSON. For example, I imagine a call like

dict = JSON3.read("""
{
  "a": { "foo": 1 },
  "b": { "bar": 2 },
}""", Dict{String, JSON3.Partial})

where the result would be a Dict with the two keys "a" and "b" and values representing the two inner dictionaries. Then, you could later call JSON3.read(dict["a"], some_type) to further parse the sub-results.

The point is to postpone the decision on how to parse the inner dictionaries; for example, their target types could depend on the keys (or each other) in complex ways.

I have the impression that this is almost possible with RawType and RawValue, but if it is, I can’t figure out how.

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

No branches or pull requests

1 participant