You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have noticed some strange behaviour where using -v to set a value will result in double output for the same key when using backslashes to escape periods in a JSON "path".
Repro steps:
Consider a little sample.json file with the content below:
So far so good! plain_example which was "tomato" is now "potato". 👍
Now, let's say I want to edit the key dotted.example1 to the same value. At first, I forget to escape the periods -- which is my bad and not a bug -- and it gives me this output:
Same issue, key appears twice and curiously the output is not identical as with -p, plus it's not formatted as prettily as one would expect! Something is definitely wrong here. 😮
Hope you can find the bug. I really love the tool otherwise! :)
The text was updated successfully, but these errors were encountered:
What version I'm using:
Hi, I'm testing this with
jj-1.2.1
on Linux.Bug description:
I have noticed some strange behaviour where using
-v
to set a value will result in double output for the same key when using backslashes to escape periods in a JSON "path".Repro steps:
Consider a little
sample.json
file with the content below:So far so good. I run
jj
on it to print it as-is and it prints as expected:First let's validate that the
-v
flag for editing a document does in fact work. Let's try with theplain_example
key...So far so good!
plain_example
which was "tomato" is now "potato". 👍Now, let's say I want to edit the key
dotted.example1
to the same value. At first, I forget to escape the periods -- which is my bad and not a bug -- and it gives me this output:Then I read the README a bit closer and learn that I need to escape them... Ok! No problem, I tell myself... let's try:
Woah, what the..?! Escaping worked as I don't get nesting in the result anymore, but now
dotted.example1
exists twice! That's not legal JSON. 💩Could it be the printing code?? Let's rule it out by writing a file out directly with the
-o
flag:Same issue, key appears twice and curiously the output is not identical as with
-p
, plus it's not formatted as prettily as one would expect! Something is definitely wrong here. 😮Hope you can find the bug. I really love the tool otherwise! :)
The text was updated successfully, but these errors were encountered: