0
나는 다음과 같은 자바 스크립트에서 JSON을 가지고Javascript에서 JSON의 속성을 추가하는 방법은 무엇입니까?
var json = {
"total": "100",
"page":"1",
"records":"100",
"rows": [
{
"no": "1",
"part_number": "2",
"part_name": "3",
"price": "4",
"note": "8"
}
]
};
나는 위의 JSON에
"test1":"5",
"test2":"7"
을 추가 할 수 있습니다.
그래서 다음과 같이 될 것입니다 : 그냥
var json = {
"total":"100",
"page":"1",
"records":"100",
"rows": [
{
"no": "1",
"part_number": "2",
"part_name": "3",
"price": "4",
"test1": "5",
"test2": "7",
"note":"8"
}
]
};
당신은 JSON 객체 리터럴하지 않았습니다. [객체에 대해 자세히 알아보기] (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Working_with_Objects). 또한이 질문을보십시오 : [액세스/프로세스 (중첩 된) 객체, 배열 또는 JSON] (http://stackoverflow.com/questions/11922383/access-process-nested-objects-arrays-or-json). –