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

gron output fails on keys containing "." #217

Closed
mpol opened this issue Sep 18, 2023 · 2 comments · Fixed by #221
Closed

gron output fails on keys containing "." #217

mpol opened this issue Sep 18, 2023 · 2 comments · Fixed by #221
Labels
bug Something isn't working

Comments

@mpol
Copy link

mpol commented Sep 18, 2023

See example:

$ restish --version
restish version 0.18.0

$ echo '{"a.b":["x"],"c.d":["y"]}'|restish https://api.rest.sh/ -o gron|grep parsed
body.parsed = {};
body.parsed["a.b"] = [];
body.parsed["a.b"][0] = "x";
body.parsed["a["c.d"] = [];
body.parsed["a["c.d"][0] = "y";
body.parsed["a.path = "/";
body.parsed["a.url = "https://api.rest.sh/";
@danielgtaylor danielgtaylor added the bug Something isn't working label Sep 19, 2023
@danielgtaylor
Copy link
Owner

A quick look tells me this is likely the PathBuffer().Pop() returning too early because it doesn't know that the a.b is one path component. Shouldn't be too hard to fix but it'll need some way to push escaped keys and pop off the whole key, not just part of it.

@mpol
Copy link
Author

mpol commented Sep 19, 2023

Yes. The same problem is caused by a [ bracket in the key and while a " quote in the key is popped correctly, it is unquoted in output, giving eg. body.parsed["a"b"] = "x";.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants