I am converting a JSON Object as below to XML File for download.
1) JSON:
[
{
"entityid": 11,
"claimid": 221
},
{
"entityid": 11,
"claimid": 456
},
{
"entityid": 11,
"claimid": 6478
},
{
"entityid": 11,
"claimid": 4343
},
{
"entityid": 11,
"claimid": 444
},
{
"entityid": 11,
"claimid": 789
},
{
"entityid": 11,
"claimid": 56
}
]
2) XML: To start with, I converted the JSON object into XML String but see the numbers displaying for each row... <0>, , <1>, etc...
<0><entityid>11</entityid><claimid>221</claimid></0>
<1><entityid>11</entityid><claimid>456</claimid></1>
<2><entityid>11</entityid><claimid>6478</claimid></2>
<3><entityid>11</entityid><claimid>4343</claimid></3>
<4><entityid>11</entityid><claimid>444</claimid></4>
<5><entityid>11</entityid><claimid>789</claimid></5>
<6><entityid>11</entityid><claimid>56</claimid></6>
3) CODE for conversion of JSON to XML:
var jsonObj = JSON.parse(JSONDownloadString);
console.log(json2xml(jsonObj));
How do I get rid of the numbers at start and end for each record?
Subsequently how do I get this into a file for Download ?
Pls help.