Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I need to create a JSON Array from XML Data 1

Status
Not open for further replies.

getjbb

MIS
Jun 4, 2003
139
0
0
US
Hello,

I have am new to Javascript(Dojo) and I need to create a JSON Array from XML data coming back from an AJAX call.

I do not know what to do after parsing the incoming data and assigning it to an XMLDOC var:

var XMLDOC = dojox.xml.DomParse.parse(data);

I am trying to keep from having to write a complicated function to convert the XML file to a JSON Array.

I am hoping that there is a command(s) or servlet that will do what I need. Where servlets are concern I do not know much about them.
I tried to use one and did not understand how to retrieve the data (XMLDOC) into the servlet.

Any help will be appreciated.

Thanks,

getjbb
 
Xmldoc will already be a Javascript object. You don't need to do anything further.


 
It was my understanding that a JS Object, which Xmldoc is, was not the same as JSON. My problem is that the web service I am using only accept XML file, but
my final data has to be in the JSON format in order for me to use it, therefore I cannot use the JS Object of Xmldoc, unless it can be converted into a JSON array.

Thanks,
getjbb
 
JSON = Javascript Object Notation.
xmldoc will already be a javascript object.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top