Lak*_*sad 7 javascript jquery json
我有一个嵌套的json.我想将其作为表单输入值发布.
但是,似乎jquery将"Object object"
字符串放入值中.
传递字符串并转换为我需要的本机形式似乎比处理json更容易,因为一旦生成它就不需要改变任何东西.
var json = {
"firstName": "John",
"lastName": "Smith",
"age": 25,
"address": {
"streetAddress": "21 2nd Street",
"city": "New York",
"state": "NY",
"postalCode": "10021"
},
"phoneNumber": [
{ "type": "home", "number": "212 555-1234" },
{ "type": "fax", "number": "646 555-4567" }
],
"newSubscription": false,
"companyName": null
};
Run Code Online (Sandbox Code Playgroud)
成串的形式?
var json = '{
"firstName": "John",
"lastName": "Smith",
"age": 25,
"address": {
"streetAddress": "21 2nd Street",
"city": "New York",
"state": "NY",
"postalCode": "10021"
},
"phoneNumber": [
{ "type": "home", "number": "212 555-1234" },
{ "type": "fax", "number": "646 555-4567" }
],
"newSubscription": false,
"companyName": null
}'
Run Code Online (Sandbox Code Playgroud)
以下没有做我需要的:
Json.stringify()
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
12096 次 |
最近记录: |