How to convert an entity to Json?

How do I avoid converting HTML tags elements into JSON Object during an XML to JSON conversion using X2JS?

  • I am using X2JS for converting XML file into JSON Object. Some XML Tags contains HTML Tags inside it. <xmltag>I am the data <strong>available</strong> for sale now</xmltag> Now I dont want the html tag "strong" to get converted into a JSONĀ  Object. When I use the variable "JsonObj.xmltag" it should return I am the data <strong>available</strong> for sale now I need to stop converting the HTML Tags into JSON Obj and allow only non-HTML tags to convert. Please Help me ..

  • Answer:

    most probably, the xml snippet you show is not even valid for the xml structure you are using. if you intend to include xml/html into an defined xml document, you should use CDATA segments to clearly seperate content from structure. For example: <xmltag><![CDATA[I am the data <strong>available</strong> for sale now]]></xmltag>

Constantinus van der Kruijs at Quora Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.