From: Adam Dickmeiss Date: Wed, 20 Jan 2010 14:05:19 +0000 (+0100) Subject: Fix JSON parser WRT start symbol X-Git-Tag: v4.0.1~9^2~10 X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=commitdiff_plain;h=8a6e1b377726cca5f60ce249b1a5bfcb6616bdab Fix JSON parser WRT start symbol The start grammar symbol (referred to as JSONText in ECMA-262) is JSONValue, not JSONObject. --- diff --git a/src/json.c b/src/json.c index 4c41613..6c34fcb 100644 --- a/src/json.c +++ b/src/json.c @@ -420,7 +420,7 @@ struct json_node *json_parser_parse(json_parser_t p, const char *json_str) p->buf = json_str; p->cp = p->buf; - n = json_parse_object(p); + n = json_parse_value(p); if (!n) return 0; c = look_ch(p); diff --git a/test/tst_json.c b/test/tst_json.c index 8720290..eace27e 100644 --- a/test/tst_json.c +++ b/test/tst_json.c @@ -49,9 +49,9 @@ static void tst1(void) YAZ_CHECK(expect(p, "", 0)); - YAZ_CHECK(expect(p, "1234", 0)); + YAZ_CHECK(expect(p, "1234", "1234")); - YAZ_CHECK(expect(p, "[ 1234 ]", 0)); + YAZ_CHECK(expect(p, "[ 1234 ]", "[1234]")); YAZ_CHECK(expect(p, "{\"k\":tru}", 0));