Request: support to simplified json #88

wants to merge 3 commits into


None yet
1 participant

fungos commented Nov 25, 2012

Added support to parse a simplified json format where it doesn't require redundant symbols as double quotes for strings and commas.

To be sure that this change wouldn't touch the normal parser I have duplicated the two string helper functions yajl_string_scan and yajl_lex_string as yajl_unquoted_string_scan and yajl_lex_unquoted_string. I know that it is uggly and we can merge these, but I felt it was safer this way.

In yajl_lex_lex I changed the cases f, t, n to jump to a invalid block that is the same as default, but this means we've lost the error yajl_lex_invalid_string.

I have tested all my json files with this parser and It does the job correctly.
Also, I haven't added any test cases for this, maybe later I will do, not sure :( .

fungos added some commits Nov 25, 2012

@fungos fungos Added support to parse a simplified json format
To enable sloppy json parsing toggle yajl_allow_sloppy_format config on
by using: "yajl_config(h, yajl_allow_sloppy_format, 1);"
@fungos fungos Added missing string terminators
Added \t \f \v \r as possible string terminators for unquoted strings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment