Convert an array to XML or JSON

后端 未结 4 1094
执念已碎
执念已碎 2020-12-19 22:57

I want to convert the array below

Array
(
    [city] => Array
        (
            [0] => Array
                (
                    [0] => Rd
            


        
4条回答
  •  庸人自扰
    2020-12-19 23:23

    Which programming language are you using ?

    In case you are using PHP you can use the following to convert to JSON:

    $json = json_encode($your_array);
    

    And for XML you can check the following answer: How to convert array to SimpleXML.

    Hope it helps.

提交回复
热议问题