jsmn icon indicating copy to clipboard operation
jsmn copied to clipboard

Parsing of non-strict JSON seems broken

Open kugelblitz opened this issue 10 years ago • 2 comments

Hello,

Jsmn works great for me on strict JSON, but I am having trouble parsing any non-strict JSON, even the one from the site:

server: example.com post: 80 message: "hello world"

The results do not make sense, they have (start < end) condition broken and have wrong number of children.

kugelblitz avatar Oct 09 '15 16:10 kugelblitz

I had a similar issue, where non-strict tokens would parse as JSMN_UNDEFINED tokens but the start/end values were correct and had no issues with number of children (at-least off the latest HEAD).

The solution I had was to remove the JSMN_STRICT check surrounding the failing to find the end of a primitive before end of buffer check here: https://github.com/zserge/jsmn/blob/master/jsmn.c#L59

netarc avatar Nov 04 '15 01:11 netarc

Actually I take that back, I must have experienced that issue with an older version of jsmn as even reverting my suggested change still works as expected in the latest HEAD.

netarc avatar Nov 04 '15 02:11 netarc