后台给了我一个json数据格式让我传过去,对象里面还有对象,要怎么写相关代码// 请把代码文本粘贴到下方(请勿用图片代替代码)json格式: { "cityid":"100003530", "region":
{ "region":"123"
}, "cityname":"nihao"
}如果是单纯的 { "cityid":"100003530", "region": "123", "cityname":"nihao"
} var obj={};
obj.cityid='100003530';
obj.region='123';
obj.cityname='nihao';我可以 请教下像第一种要怎么写?
2 回答
慕村9548890
TA贡献1884条经验 获得超4个赞
没看懂问题想表达的是什么
let obj = { "cityid":"100003530", "region": { "region":"123" }, "cityname":"nihao" } obj.cityid = "100003530" obj.region = { "region":"123" } obj.region = {} obj.region.region = "123" obj.cityname = "nihao"
慕婉清6462132
TA贡献1804条经验 获得超2个赞
var obj={}; obj.cityid='100003530'; obj.region={region: '123'}; obj.cityname='nihao';
添加回答
举报
0/150
提交
取消