json xml converter having array in json string

前端 未结 4 1683
余生分开走
余生分开走 2021-01-25 15:07

I need to convert a json to xml and later on converting that json back to xml, but i am loosing the json array object while this conversion - I am using org.json lib.

4条回答
  •  北荒
    北荒 (楼主)
    2021-01-25 16:04

    Maybe you can be helped with the JSON-XML mapping described here:

    The readers and writers produced by the JsonReaderWriterFactory provide an XML API over JavaScript Object Notation (JSON) content. (source)

    It can convert:

    {
        "readResult": {
            "errors": [{
                "code": 400
            }]
        }
    }
    

    to:

    
        
            
                400
            
        
    
    

    NB: I also implemented this conversion in JavaScript and in PHP.

提交回复
热议问题