大家好,欢迎来到IT知识分享网。
json数据文件的数据格式可以用下边两种方式写:
1.在只有一类数据的情况情况下f.json文件:
[
{“name”:”致美丽的你—-红玫瑰11枝”,”pic”:1,”price”:128,”num”:3},
{“name”:”夏之物语—-香槟玫瑰50枝”,”pic”:2,”price”:386,”num”:7},
{“name”:”为爱相随—-百合+黛安娜粉玫瑰”,”pic”:3,”price”:186,”num”:11},
{“name”:”感激—-29枝红康乃馨”,”pic”:4,”price”:229,”num”:8},
{“name”:”暖暖情意—-粉色康乃馨16枝”,”pic”:5,”price”:189,”num”:24},
{“name”:”温馨思念—-红色康乃馨16枝”,”pic”:6,”price”:160,”num”:16},
{“name”:”爱的祝福”,”pic”:7,”price”:188,”num”:6},
{“name”:”蓝色永生玫瑰”,”pic”:8,”price”:269,”num”:12}
]
2.在多重数据的情况下,就需要嵌套数组,fc.json文件:
{
“flower”:[
{“name”:”致美丽的你—-红玫瑰11枝”,”pic”:1,”price”:128,”num”:3},
{“name”:”夏之物语—-香槟玫瑰50枝”,”pic”:2,”price”:386,”num”:7},
{“name”:”为爱相随—-百合+黛安娜粉玫瑰”,”pic”:3,”price”:186,”num”:11},
{“name”:”感激—-29枝红康乃馨”,”pic”:4,”price”:229,”num”:8},
{“name”:”暖暖情意—-粉色康乃馨16枝”,”pic”:5,”price”:189,”num”:24},
{“name”:”温馨思念—-红色康乃馨16枝”,”pic”:6,”price”:160,”num”:16},
{“name”:”爱的祝福”,”pic”:7,”price”:188,”num”:6},
{“name”:”蓝色永生玫瑰”,”pic”:8,”price”:269,”num”:12}
],
“cake”:[
{“name”:”提拉米苏(8寸)”,”pic”:1,”price”:128,”num”:3},
{“name”:”恋爱的心(6寸)”,”pic”:2,”price”:386,”num”:7},
{“name”:”柳橙慕斯(8寸)”,”pic”:3,”price”:186,”num”:11},
{“name”:”臻爱礼盒(6寸)”,”pic”:4,”price”:229,”num”:8},
{“name”:”四重奏蛋糕(8寸)”,”pic”:5,”price”:189,”num”:24},
{“name”:”你好米菲蛋糕(1磅)”,”pic”:6,”price”:160,”num”:16},
{“name”:”蓝莓轻乳蛋糕(1磅)”,”pic”:7,”price”:188,”num”:6},
{“name”:”在一起(8寸)”,”pic”:8,”price”:269,”num”:12}
]
}
免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://haidsoft.com/157416.html