Merge pull request #13 from indutny/fix/handling-files-with-whitespace

Skip whitespace at the start of string/file
pull/15/head
Krzysztof Gabis 11 years ago
commit 19a0d79db4
  1. 5
      parson.c
  2. 3
      tests/test_1_1.txt

@ -619,7 +619,10 @@ JSON_Value * json_parse_file_with_comments(const char *filename) {
}
JSON_Value * json_parse_string(const char *string) {
if (!string || (*string != '{' && *string != '['))
if (!string)
return NULL;
skip_whitespaces(&string);
if (*string != '{' && *string != '[')
return NULL;
return parse_value((const char**)&string, 0);
}

@ -1,4 +1,5 @@
[
[
"JSON Test Pattern pass1",
{"object with 1 member":["array with 1 element"]},
{},

Loading…
Cancel
Save