There definitely is a lack of good JSON parsers for C. We wrote our own in QEMU. The relevant code is: http://git.qemu.org/?p=qemu.git;a=blob;f=json-lexer.c;h=3cd3... http://git.qemu.org/?p=qemu.git;a=blob;f=json-parser.c;h=849... Among other things, this supports streaming, is fairly fast, and has gotten a fair bit of scrutiny against malicious input. The lexer is a hand written state machine which seems like someth…
What's wrong with YAJL?
Show HN: Very low footprint JSON parser in portable ANSI C
51–58 of 58 posts
Re: Show HN: Very low footprint JSON parser in portable ANSI C
#52Here's another minimalist alternative: https://bitbucket.org/zserge/jsmn/wiki/Home I've used it and think it's pretty neat. One of these days I'll get around to releasing the helper functions we've written to make it easier to use too.
Re: Show HN: Very low footprint JSON parser in portable ANSI C
#53Hint: A JSON parser should have functions 'parse-object'/'parse-string'/'parse-number'or something!
Re: Show HN: Very low footprint JSON parser in portable ANSI C
#54This Show HN makes me think there needs to be a site for more formalized code reviews of open software. Ideally with some great game mechanics to make sure engagement is high and thing are getting reviewed well.
As a younger programmer with great ambitions, some sort of code review site would be awesome!
Re: Show HN: Very low footprint JSON parser in portable ANSI C
#55There definitely is a lack of good JSON parsers for C. We wrote our own in QEMU. The relevant code is: http://git.qemu.org/?p=qemu.git;a=blob;f=json-lexer.c;h=3cd3... http://git.qemu.org/?p=qemu.git;a=blob;f=json-parser.c;h=849... Among other things, this supports streaming, is fairly fast, and has gotten a fair bit of scrutiny against malicious input. The lexer is a hand written state machine which seems like someth…
case JSON_INTEGER:
obj = QOBJECT(qint_from_int(strtoll(token_get_value(token), NULL, 10)));
Why is it so hard to parse integer from string correctly?Re: Show HN: Very low footprint JSON parser in portable ANSI C
#56On a related note, if you want to get something done on a sunday afternoon, writing a simple recursive descent JSON parser from scratch is both doable and fun.
Re: Show HN: Very low footprint JSON parser in portable ANSI C
#57This Show HN makes me think there needs to be a site for more formalized code reviews of open software. Ideally with some great game mechanics to make sure engagement is high and thing are getting reviewed well.
Link: http://codetique.com
Re: Show HN: Very low footprint JSON parser in portable ANSI C
#58I like using Jansson: http://www.digip.org/jansson/