Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugs in jsoncons::jsonpath::flatten() #255

Closed
wbangna opened this issue Jul 1, 2020 · 1 comment
Closed

Bugs in jsoncons::jsonpath::flatten() #255

wbangna opened this issue Jul 1, 2020 · 1 comment

Comments

@wbangna
Copy link
Contributor

wbangna commented Jul 1, 2020

I wrote a small test program and I think I found two bugs.
https://gist.github.com/wbangna/b15370aab120ff5cc34784374d2189a6

The Output of the program is

{
    "$['data'][\"d'ef\"]": "def", 
    "$['data'][\"x\"y'z\"]": "xyz", 
    "$['data']['a\"bc']": "abc", 
    "$['data']['g.hi']": "ghi", 
    "$['data']['j\\kl']": "jkl", 
    "$['data']['m/no']": "mno"
}
1) path: $['data']["d'ef"]: def == def
2) path: $['data']["x"y'z"]: Exception: Expected ] at line 1 and column 14
3) path: $['data']['a"bc']: abc == abc
4) path: $['data']['g.hi']: ghi == ghi
5) path: $['data']['j\kl']: NO MATCH
6) path: $['data']['m/no']: mno == mno

This works:
path: $['data']["x\"y'z"]: xyz == xyz

Bug1: flatten() does not escape double quotes correctly. The last line shows that the corrected JSONPath works.
Bug2: json_query() does not work with backslashes.

Edit: Forgot to metion the Version I used: 0.153.1

danielaparker added a commit that referenced this issue Jul 2, 2020
danielaparker added a commit that referenced this issue Jul 2, 2020
@danielaparker
Copy link
Owner

danielaparker commented Jul 3, 2020

You're right, thanks for reporting this. Fixed on master.

I've included your tests in the test suite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants