mjson icon indicating copy to clipboard operation
mjson copied to clipboard

mjson_find return wrong result.

Open oakfire opened this issue 3 years ago • 0 comments

    const char* j3 = "{\"a\":[],\"ab\":[{\"c1\":1,\"c2\":2},{\"c1\":3,\"c2\":4}]}";
    ASSERT(mjson_find(j3, strlen(j3), "$.a[0]", &p, &n) == MJSON_TOK_INVALID);  // this line FAIL!
    printf("mjson got: %d\n", mjson_find(j3, strlen(j3), "$.a[0]", &p, &n));  
    printf("got: %.*s\n", n, p); 

output:

mjson got 123
got: {"c1":1,"c2":2}

oakfire avatar Aug 29 '22 10:08 oakfire