Turning this XML into JSON Jquery

lola2

New Member
So I have this XML from Winamp\[code\]<dict> <key>Track ID</key><integer>0</integer> <key>Name</key><string>American Idol 2013</string> <key>Artist</key><string>Amber Holcomb</string> <key>Album Artist</key><string>Amber Holcomb</string> <key>Album</key><string>Unknown Album</string> <key>Kind</key><string>MPEG audio file</string> <key>Size</key><integer>3645</integer> <key>Total Time</key><integer>233000</integer> <key>Date Modified</key><date>Thu Mar 14 12:11:12 2013</date> <key>Date Added</key><date>Thu Apr 04 16:10:15 2013</date> <key>Bitrate</key><integer>128</integer> <key>Location</key><string>file://localhost/Z:%5Canthony%5CMusic%5CiTunes%5CiTunes%20Media%5CMusic%5CUnknown%20Artist%5CUnknown%20Album%5CAmber%20Holcomb%20-%20A%20Moment%20Like%20This%20-%20Studio%20Version%20-%20American%20Idol%202013.mp3</string> <key>File Folder Count</key><integer>-1</integer> <key>Library Folder Count</key><integer>-1</integer> </dict>\[/code\]I want to turn it into a JsonArray\[code\]var myarray = {"TrackID":0, "Name":"American IDol 2013"...};\[/code\]I found out how to loop through each tag, but I'm can't seem to wrap my head how to do this. I was thinking of creating a predefined Json array or something \[code\]{"TrackID": "", "Name":""}\[/code\], and when the JSON is complete, I push it into the master JSON (so sorry if I'm not explaining this correctly).Is there a way to make a single array of all keys and another with the rest, and then merge them into a JSON array? I could really use some advice please.Thank you all for your help.
 
Back
Top