-
Notifications
You must be signed in to change notification settings - Fork 91
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
JSON root can be other types #3
Comments
I looked it up and as far as I know JSON root nodes are only allowed to be either an object or an array. I then check it and added some addition test and as far as I can tell both work fine. Could you point me to an example that did not work so I can check what went wrong.
This is taken from my documentation at the top of the header:
I know this is probably not a perfect situation but the internal simplicity of the state machine has complex consequences for content validation. So in your given case
Currently do not have a way. I don't have much time right now but I can check later if there is a way to add it. |
In the older RFC4267, root value of JSON must be object or array. But this is relaxed in RFC7159 and ECMA-404, such that any types can be the root. However, It seems the current design of MMX mm_json.h does not store the root value in tokens, so it can not differentiate between object or array anyway. I have submitted my current integration in this branch. During the conformance tests, when it parses some invalid JSONs it goes to dead loop. You may check the test code. To make the build easier, you can delete all files in By the way, I have just added another token-based parser jsmn, which stores the root value as the first token. You may also refer to its test code. |
I am sick of it. I will remove the library. Do your benchmark without it. I don't care about all these standards and the expectation that come with it. If I wanted to have something like jsmn than I would have create something along side of or used it directly. Probably for the best so there is one less shitty json parser in this world. |
Recently I was suggested to add mm_json.h to nativejson-benchmark but I found that the root of JSON parsed by mm_json.h must be object type.
When parsing an invalid JSON
["Extra close"]]
the parser seems go into dead-loop.P.S. How to get number of key-value pairs at the root?
The text was updated successfully, but these errors were encountered: