Complex JSON nesting of objects and arrays

前端 未结 5 1666
清歌不尽
清歌不尽 2020-12-23 09:51

I am having difficultly with syntax and structure of JSON objects/arrays.

{ 
  \"accounting\" : [   
                     { \"firstName\" : \"John\",  
              


        
5条回答
  •  情歌与酒
    2020-12-23 10:03

    First, choosing a data structure(xml,json,yaml) usually includes only a readability/size problem. For example

    Json is very compact, but no human being can read it easily, very hard do debug,

    Xml is very large, but everyone can easily read/debug it,

    Yaml is in between Xml and json.

    But if you want to work with Javascript heavily and/or your software makes a lot of data transfer between browser-server, you should use Json, because it is pure javascript and very compact. But don't try to write it in a string, use libraries to generate the code you needed from an object.

    Hope this helps.

提交回复
热议问题