-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Scenario:
{ "a.b": 1, "a": { "b": 2 } }
Description:
Since "a.b"
is a valid key, the .
must be escaped before appending to the path, in order to not be confused with "a"."b"
. A more robust way of dealing with this issue would be to quote the key, as you can also have things like whitespace in the key, or even an empty string as key. A reference approach at https://jqplay.org/s/7sO6XJmPdTZ where I recreated the scenarios using jq
.
Code Reference:
Possible Solution:
return new JSONHeroPath(string.concat(`."${key}"`));
Related Issues:
None in this repository, but unfortunately caused one in triggerdotdev/jsonhero-web#98.
Feel free to let me know if there is a better way to solve this (or if my proposed solution will break something), otherwise I will start working on a PR.
Metadata
Metadata
Assignees
Labels
No labels