Fix mg_json_get for the array element result not as expected.

This commit is contained in:
oakfire committed 2022-09-01 15:02:17 +08:00
1 parent 83c76bdafc
commit 8131e30002
2 files changed
+5

No files matched your search

+4
View File
@@ -2508,6 +2508,10 @@ static void test_json(void) {
ASSERT(mg_json_get_long(json, "$[1].b", -42) == 4);
ASSERT(mg_json_get_long(json, "$[2].a", -42) == -42);
json = mg_str("{\"a\":[1],\"b\":[2,3]}");
ASSERT(mg_json_get_long(json, "$.a[0]", -42) == 1);
ASSERT(mg_json_get_long(json, "$.a[1]", -42) == -42);
}
}