Json的数据格式大致分为四种:

第一种方式:(相当于java种的map(key,value))

var json={
 key:value,
 key:value,
 key:value
};

key必须是字符串,value值可以是任意数据类型

第二种方式:(相当于java种的List<对象>)

var json=[
            {key:value,key:value},
            {key:value,key:value}
         ];

第三种方式:(相当于java种的Map<String,List<Person>>)

var json=[
    {
        key:value,
        key:value
    },
    {
        key:value,
        key:value
    }
]

第四种方式:(相当于java中的Map<String,List<对象>>)

var json={
     "param":[
                {key:value,key:value},
                {key:value,key:value}
            ],
     "param1":[
                {key:value,key:value},
                {key:value,key:value}
            ]
 }

 

 

GitHub 加速计划 / js / json
18
5
下载
适用于现代 C++ 的 JSON。
最近提交(Master分支:3 个月前 )
0f9e6ae0 Signed-off-by: Niels Lohmann <mail@nlohmann.me> 16 小时前
8a882f32 * Support any basic_json type in NLOHMANN_DEFINE_TYPE_* macros Signed-off-by: kimci86 <kimci86@hotmail.fr> * Test NLOHMANN_DEFINE_TYPE_* macros also support unordered_json Signed-off-by: kimci86 <kimci86@hotmail.fr> * Simplify test about NLOHMANN_DEFINE_TYPE_ with many arguments Signed-off-by: kimci86 <kimci86@hotmail.fr> * Remove extra scope in macros tests Signed-off-by: kimci86 <kimci86@hotmail.fr> * Remove unused test class in macros tests Signed-off-by: kimci86 <kimci86@hotmail.fr> * Update documentation about NLOHMANN_DEFINE_TYPE_* macros Signed-off-by: kimci86 <kimci86@hotmail.fr> * Fix NLOHMANN_JSON_SERIALIZE_ENUM documentation Signed-off-by: kimci86 <kimci86@hotmail.fr> * Mark some variables const in macros tests, fixes clang-tidy Signed-off-by: kimci86 <kimci86@hotmail.fr> * Workaround clang 3.5 issue with const object initialization Signed-off-by: kimci86 <kimci86@hotmail.fr> * Update highlighted lines in NLOHMANN_DEFINE_TYPE_* macros examples Signed-off-by: kimci86 <kimci86@hotmail.fr> * Fix swapped macros in documentation Signed-off-by: kimci86 <kimci86@hotmail.fr> * Remove extra backslashes at the end of macros Signed-off-by: kimci86 <kimci86@hotmail.fr> * Require basic_json type in NLOHMANN_DEFINE_TYPE_* generated functions Signed-off-by: kimci86 <kimci86@hotmail.fr> * Fix typos in macros documentation Signed-off-by: kimci86 <kimci86@hotmail.fr> --------- Signed-off-by: kimci86 <kimci86@hotmail.fr> 16 小时前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐