danielaparker / jsoncons

A C++, header-only library for constructing JSON and JSON-like data formats, with JSON Pointer, JSON Patch, JSON Schema, JSONPath, JMESPath, CSV, MessagePack, CBOR, BSON, UBJSON
https://danielaparker.github.io/jsoncons
Other
699 stars 158 forks source link

jsonpath query empty array's length expect [0] but get [] #416

Closed zongyanke closed 1 year ago

zongyanke commented 1 year ago

Describe the bug string jsonStr = R"( { "comments": [] } )"; json data = json::parse(jsonStr.c_str()); json result = jsonpath::json_query(data, "$.comments.length");

result == [0]

result == []

economicseries commented 1 year ago

You're right, should be fixed on master, thanks for reporting this.

danielaparker commented 1 year ago

Fix is in 0.170.0