basic_json::parser_callback_t: Maintain state across events #2440
georgios-v
started this conversation in
Ideas
Replies: 1 comment 2 replies
-
|
I'm afraid that changing |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Currently the parse callback method has extremely limited usability: namely to enforce a json schema with no contextual knowledge.
If the callback method could be extended to maintain any type of state across events, it could be used for a large number of extra tasks, like enforcing uniqueness for keys or values.
Take for example:
Currently a custom parser is required to detect the duplicate values. However maintaining a simple list of passed values could accomplish this with a single pass of the document during parsing.
So I propose to create a new type of callback with signature as:
Beta Was this translation helpful? Give feedback.
All reactions