Is it possible to get realtime escape of HTML in a JSON file?

Is it possible to isolate a section of a JSON file and write that section in HTML.   but then the output would be automatically escaped?

 

{ "mykey" : "<div>My Value<\/div>" }

 

but when you write it, you can write it as HTML and then it automatically escapes the backslashes?    I have come close with taking that fragment in the JSON and showing it as HTML allowing me to use emmet and auto-complete and syntax highlighting but when I want to convert it back to a unescaped string its a pain.

1 comment

Don't understand what feature you are looking for... Auto-escaping characters in JSON while you enter them? There is no such feature... You can try String Manipulation plugin (https://plugins.jetbrains.com/plugin/2162-string-manipulation) - it supports escaping/un-escaping JavaScript

I'm, however, not sure why you'd need escaping HTML in string literals - 

"<div>My Value</div>"

is a valid JSON string, no escaping is needed

1

Please sign in to leave a comment.