javascript - Parsing XML with JSON, also containing XML, embedded in an attribute of a tag -


i have xml response, similar below, need parse <message> out of contained within json inside of attribute. comes in form of string.

"<response attr1='hello' bar='{ \"int\": 50, \"bool\": false, \"message\":\"&lt; message &gt; test message &lt;a href=\"http://www.blah.com\"&gt;here&lt;/a&gt;  &lt; /message &gt;\" }'/>;" 

i've found nice pure javascript answers such here perfect however, can see example above, xml contains json xml within, , parser parses <a> , <message> tags need preserve.

what easiest way of going implementing this? solution needs pure javascript, no libraries.

edit: https://jsfiddle.net/ree3c7w0/ shows attempt @ trying extract json whilst preserving xml within json , way escape xml within json

you need use software escape xml embedding json , escape json embedding xml.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -