JSON to XML Using Javascript

前端 未结 6 940
南旧
南旧 2020-12-11 09:25

I am trying to convert the JSON to XML but not getting exact output.In My JSON having array object it not converting that to XML array.Mainly array object is not converti

6条回答
  •  南方客
    南方客 (楼主)
    2020-12-11 10:03

    Xml-to-json library has method jsonToXml(json). I am the maintainer of the project.

    var inputJSON = '{"body":{"entry": [{ "fullURL" : "abcd","Resource": "1234"},{ "fullURL" : "efgh","Resource": "5678"}]}}';
    
    var xml = jsonToXml(inputJSON);
    
    // 
    // 
    //   
    //     abcd
    //     1234
    //   
    //   
    //     efgh
    //     5678
    //   
    // 
    

提交回复
热议问题