If you are fine to use the online URL, then you can use the below link to add the code and then click on unescape json button, it shall give you the formatted code with one click.
You can then copy it notepad ,vscode or any other preferred tool and do the necessary modification. Once the modifications are done, you can again take the code and paste it in the above link and click on the escape json, this shall give you the code which you can directly update using update connector rule API or submit to expert team if it is a cloud rule.
If you are not looking for online resources, then I personally prefer vscode as it also allows us to escape and unescape json with 3-4 steps. Please let me know if you will need the information, i can share it then.
Can you please share the detailed information step by step to escape the characters using notepad++ or Visual studio. we don’t have access to use the online link.
Thanks for your response. Can you please help me to convert the xml rule to json format rule by adding escape character, which we will use in postman to commit. Can you please let me know if any short cut is there using note pad++.
you can do that all in one replacement step (search mode: Extended) and it will stop accidental replacement of | characters you may have (if they exist)
we are working on web service connector application ,for this we have developed on before operation rule, we need to push that rule into cloud, where we have to follow proper format right, that we are not able to convert it. Ex : removing new line with \n and removing double quote with ".
Thanks for trying to help us, but we are not able to access that link, because we don’t have permission to access the site. is there any alternative way we can do it using notepad++.
I can understand that some organization does not allow to use online URL. For escaping un-escaping the json, below are the steps that i generally perform via VsCode.
Open a new file in vs code using key (control+n) .
select the language type java or powershell as per your need. I believe for web service connector you will be using java most probably.
Now here, we need to mainly replace the below keyword
- \n with newline
- \" with double quotes " .
- \t with normal spaces (1 or multiple depending on your need) or tab spaces
To replace the \n with newline, press control+H key. In the first field enter \n. And in the replacing character field type shift+enter. then click on replace all button.
This should replace all the newline characters with new line.
Similarly, to replace the double quotes, press control+H key. In the first field enter \" and in the replacing character field type ". Then click
on replace all characters button.
for \t, again press control+H keys. In main sheet, select any empty line and hit tab and then copy the text of this tab. In the first field enter \t and then in the replacing character field, enter control+v and then click on replace all characters button on vs code.
This will be your unescaped json version and then you can make the changes to the code.
Once the changes are done, again open a new file (control +n ) and follow the below steps to convert the code into escaped json format.
Similarly, to replace the double quotes, press control+H keys. In the first field enter " and in the replacing character field type \". Then click
on replace all character button.
To replace tab spaces with \t, again enter tab key in your file and copy the text of tab key. Then press control+H, in find character, control+v and in replacing character field add \t and then click on replace all characters button.
To replace the all newlines with \n, press control+H key. In the first field enter shift+enter key. And in the replacing character field type \n. then click on replace all button.
This should replace all the new line with newline characters \n.
The steps may look long but as requested these are the detailed steps and i am sure if you try it couple of times, it will hardly take you a minute to perform them.
There are also some cool tricks in vs code where you can select a character and then find all occurances immediately and then replace them without having to
press control+h again and again but i would suggest you to please explore them in vs code.
For VSCode users - please have a look at the Hediet Power Tools extension: Hediet Power Tools - Visual Studio Marketplace
It has a JSON escape assistance which allows you to directly edit the json embedded source code of the rule with a right click.
VSCode has now the script editor integrated in the new version.
A right click on the rule will give you a “Edit Script” option.
Does even have syntax highlighting