所以我一直在掙扎JSON一段時間了,然而昨晚奇怪的事情發生了,甚至儘管我有「逃脫它帶來了一個錯誤,這是我的JSON字符串JSON解析失敗了藍色
var data = $.parseJSON('{"rows":[{"type":"row","width_class":"row new_row","column_class":"col3 column_model","columns":{"0":{"class":"column one","children":[]},"1":{"class":"column one","children":[{"type":"bullet-block","html":"<div class=\\"bullet-block-element\\"><ul><li style='padding-left:36px;background-image:url(\\"http://example.com/includes/images/bulletins/large-0.png\\");'>123</li><li style='padding-left:36px;background-image:url(\\"http://example.com/includes/images/bulletins/large-0.png\\");'>456</li><li style='padding-left:36px;background-image:url(\\"http://example.com/includes/images/bulletins/large-0.png\\");'>789</li></ul></div>","image":"http://example.com/includes/images/bulletins/large-0.png","size":"large","items":["123","456","789"]}]},"2":{"class":"column one","children":[]}}}]}');
這是通過產生
var data = $.parseJSON('<?= str_replace('\\','\\\\',base64_decode($data['d'])) ?>');
我只是爲盲人或有我有太多的紅牛?幫助將不勝感激!
,它會將JSON字符串分配給數據變量,但是我需要的數據實際上是json對象? – 2014-09-05 11:06:21
注意:PHP中沒有引號,它不會是一個字符串,它是實際的數據。 – DanFromGermany 2014-09-05 11:07:22
你每天都會學到新的東西,謝謝! – 2014-09-05 11:11:29