Closed Overtonesinger closed 9 years ago
I didn't write jsmn, so I don't know what has changed. My examples still work with the bundled version of jsmn in this repository. I don't plan to upgrade it.
In case it helps, I tried out the latest version of jsmn on a branch, here: https://github.com/alisdair/jsmn-example/commit/f14af1e59ccf385354e7c16db44e26cd94e65e74
As of now, only the GitHub example is working, so I haven't been able to test very thoroughly. It looks like jsmn is reporting the number of tokens for an object differently. Instead it would report two tokens for every key-value pair. Now it seems that it only reports one token.
Sorry that I can't help further. The jsmn repository seems to have better examples nowadays. Maybe that would be a better source: https://bitbucket.org/zserge/jsmn/
I adapted the json.c , added param "strlen(js)", so that the NEW API calls will pass: ret = jsmn_parse(&parser, js, strlen(js), tokens, n);
The JSON from url is received OK, I checked for it.
But somehow, with the new API, this example always gives me the mentioned error: "Invalid response: object keys must be strings." (Ubuntu 12.04 LTS x64, C Project in Eclipse Kepler, GCC Toolchain, Eclipse-generated Makefiles)
For the author of the program, it would be a few minutes to step, debug and find the cause, because he knows the intent behind every piece of the code there.
So I am reporting this issue with latest "jsmn.c" and "jsmn.h" code.