Describe the bug
Just trying to use CyberChef to do a useful JSON DIFF
Since the default JSON option of the Diff recipe is only useful when both JSON are beautified (exemple of what I mean by "not useful when not beautified": https://gchq.github.io/CyberChef/#recipe=Fork('%5C%5Cn%5C%5Cn','%5C%5Cn%5C%5Cn',false/disabled)JSON_Beautify('%20%20%20%20',true/disabled)Diff('%5C%5Cn%5C%5Cn','JSON',true,true,false)&input=eyJmb28iOiBbImJhciJdfQoKewogICAgImZvbyI6IFsKICAgICAgICAidmFyIgogICAgXSwKICAgICJiYXoiOiBbdHJ1ZV0KfQ )
I tried to beautify both compared JSON using the JSON Beautify recipe (through a Fork recipe to be able to beautify 2 valid JSON in 1 input), but it looks like the Merge delimiter is also put to the end of the output (which becomes the new input for the next recipe), so it makes the Diff recipe fails (because there are now 2 delimiters instead of 1).
To Reproduce
https://gchq.github.io/CyberChef/#recipe=Fork('%5C%5Cn%5C%5Cn','%5C%5Cn%5C%5Cn',false)JSON_Beautify('%20%20%20%20',true)Diff('%5C%5Cn%5C%5Cn','JSON',true,true,false)&input=eyJmb28iOiBbImJhciJdfQoKewogICAgImZvbyI6IFsKICAgICAgICAidmFyIgogICAgXSwKICAgICJiYXoiOiBbdHJ1ZV0KfQ
Expected behaviour
The Merge delimiter of the Fork recipe should not be added to the end of the output.
It should only be placed at the same place the Split delimiter was found in the first place.
Screenshots
JSON Beautify is applied to both JSON:

DIFF fails (probably) because it compares the 2nd JSON with nothing (because the ouput of JSON Beautify seems to contain \n\n at the end):

Desktop (if relevant, please complete the following information):
Tell me if you need help to fix this issue, I could try to look into CyberChef sources and submit a PR.
You're absolutely right, I'll take a look at it now.
You will also need to use the Merge operation to end the fork, otherwise you'll be trying to diff each JSON blob separately within a fork.
In the meantime, you can use the Head operation with a value of -2 to strip off the final two newlines: https://gchq.github.io/CyberChef/#recipe=Fork('%5C%5Cn%5C%5Cn','%5C%5Cn%5C%5Cn',false)JSON_Beautify('%20%20%20%20',true)Merge()Head('Nothing%20(separate%20chars)',-2)Diff('%5C%5Cn%5C%5Cn','JSON',true,true,false)&input=eyJmb28iOiBbImJhciJdfQoKewogICAgImZvbyI6IFsKICAgICAgICAidmFyIgogICAgXSwKICAgICJiYXoiOiBbdHJ1ZV0KfQ
I've pushed a fix for this in v9.7.17
Thanks!
I was looking for something like the Head recipe, but I didn't manage to find it (was typing remove/end in the search bar) 馃帀
Thank you for the great tool 馃憤
I will consider modifying the description for the Head and Tail operations so they get returned in more searches.
Thanks for the feedback, always good to hear!