我有這麼這麼一個json文本:
var jsondata={"name":圖圖,"provice":340000,"city":341200,"district":341226,"sex":1,"job":01000};
以及一個數組:arr=
[{birth: "2016-04-07",id: "2",sex: "2"},{birth: "2016-04-07",id: "2",sex: "2"}]
問:現在怎麼把這個數組和這個jsondata結合,形成這樣的json格式:
{
"name": "圖圖",
"province": "340000",
"city": "341200",
"district": "341226",
"sex": "1",
"job": "01000",
"baby": [
{
"id": "1",
"name": "5555555555",
"user_id": "3",
"sex": "1",
"birth": "1461340800"
},
{
"id": "2",
"name": "44444444444",
"user_id": "3",
"sex": "2",
"birth": "1459958400"
}
]
}
var jsondata={"name":'圖圖',"provice":'340000',"city":'341200',"district":'341226',"sex":1,"job":'01000'};
var arr=[{birth: "2016-04-07",id: "2",sex: "2"},{birth: "2016-04-07",id: "2",sex: "2"}]
jsondata.baby=arr;