parseJSON 을 사용하면 되는 건 맞는데!!! 주의 할 점!!!
문서 대강대강 보다가.. 2시간 날림..!!
문자열 만들때..
1
2
|
|
반드시!!! 쌍따옴표를 써야 한다.. javascript여서.. 홑따옴표로 변형해서 썼더니 절대 안됐음..
설명을 잘 읽어 볼걸......
Passing in a malformed JSON string results in a JavaScript exception being thrown. For example, the following are all invalid JSON strings:
"{test: 1}"
(test does not have double quotes around it)."{'test': 1}"
('test' is using single quotes instead of double quotes)."'test'"
('test' is using single quotes instead of double quotes).".1"
(a number must start with a digit;"0.1"
would be valid)."undefined"
(undefined
cannot be represented in a JSON string;null
, however, can be)."NaN"
(NaN
cannot be represented in a JSON string; direct representation ofInfinity
is also not permitted).
댓글 없음:
댓글 쓰기