- Notifications
You must be signed in to change notification settings - Fork 86
Open
Description
The very nice mjson library really needs to support json fields with spaces in their names. For example, consider the following valid json:
{ "translations": { "expression with spaces": { "fr": "Translation of Expression1 in French", "es": "Translation of Expression1 in Spanish", "de": "Translation of Expression1 in German" } } } The following JSONpath statements are valid to perform a lookup:
$.["translations"]["expression with spaces"]["fr"] $.translations."expression with spaces".fr But none will work in mjson:
const char *s = \ "{" "\"translations\": {" "\"expression with spaces\": {" "\"fr\": \"Translation of Expression1 in French\"," "\"es\": \"Translation of Expression1 in Spanish\"," "\"de\": \"Translation of Expression1 in German\"" "}" "}" "}\""; const char *xp = "$.translations.\"expression with spaces\".fr"; char *p; int m; int n = mjson_find(s, strlen(s), xp, &p, &m); mjson_find will always return zero.
As such, there is no way to construct a JSONpath statement to query JSON objects that contain spaces in their names using mjson. This is a trivial JSONpath statement, no fancy functions here.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels