toggle JSON escaped chars?

Having trouble installing Oxygen? Got a bug to report? Post it all here.
mhGLEIF
Posts: 43
Joined: Tue Jul 26, 2016 6:31 pm

toggle JSON escaped chars?

Post 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?
adrian
Posts: 2855
Joined: Tue May 17, 2005 4:01 pm

Re: toggle JSON escaped chars?

Post 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
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
mhGLEIF
Posts: 43
Joined: Tue Jul 26, 2016 6:31 pm

Re: toggle JSON escaped chars?

Post 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?
adrian
Posts: 2855
Joined: Tue May 17, 2005 4:01 pm

Re: toggle JSON escaped chars?

Post 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
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
adrian
Posts: 2855
Joined: Tue May 17, 2005 4:01 pm

Re: toggle JSON escaped chars?

Post by adrian »

Hi,

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

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Post Reply