Page 1 of 1

toggle JSON escaped chars?

Posted: Mon Apr 24, 2017 10:40 am
by mhGLEIF
Dear oxygen team,

I have some JSON files that include xml strings within them.

To conform to JSON the XML strings have been heavily escaped.

How can I quickly and conveniently toggle back and forth between JSON-escaped string and XML string, so that I can edit as XML and/JSON?

Re: toggle JSON escaped chars?

Posted: Mon Apr 24, 2017 10:58 am
by adrian
Hi,

The JSON editor from Oxygen does not have specialized actions in this regard. It is however possible to do this with the help of an XML document, since the XML editor that can easily escape/unescape chars.
What you can do is:
1. In the JSON document select and copy to clipboard the escaped XML content.
2. Create a new XML document (File > New > XML) and paste the escaped XML content there.
3. In the XML document, select all the escaped XML content, right click on the selection and use the action Source > Unescape Selection... (make sure the appropriate options are checked)
4. In the XML document, edit as XML as you like.
5. When/If you want to put it back in the JSON document, select the entire content you need in the XML document and use the action Source > Escape Selection...
6. Copy the escaped content from the XML document and put it back in the JSON document.

Regards,
Adrian

Re: toggle JSON escaped chars?

Posted: Thu Apr 27, 2017 3:42 pm
by mhGLEIF
Thanks Adrian,

the problem is that the escape characters work for JSON, not XML - they are not XML entities, but JSON "entities" like

Code: Select all

",{}[]
.

I guess that oxygen doesn't do JSON excaping?

Re: toggle JSON escaped chars?

Posted: Thu Apr 27, 2017 5:33 pm
by adrian
Hi,

No, there is no JSON escaping in Oxygen. Only XML-escaping.

I've logged a feature request for this (JSON escaping) on our issue tracking tool. For reference it is issue EXM-39319.
We will notify this thread when it is implemented.

Regards,
Adrian

Re: toggle JSON escaped chars?

Posted: Fri Apr 28, 2017 5:24 pm
by adrian
Hi,

Our developers are asking for an example for this (with and without escaping). Could you please provide one?

Regards,
Adrian