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

+1
View File
@@ -2602,6 +2602,7 @@ int mg_json_get(struct mg_str json, const char *path, int *toklen) {
} else if (c == ',') {
expecting = (nesting[depth - 1] == '{') ? S_KEY : S_VALUE;
} else if (c == ']' || c == '}') {
if (depth == ed && ei >= 0) ci--; // Array ends, as ci is pre-added by 1, needs to be decremented before MG_EOO
MG_EOO('O');
if (depth == ed && ei >= 0) ci++;
} else {