我從MySQL表中檢索具有下列格式的JSON編碼對象:印刷陣列
{immovable_property:
"{"immovable_subdivision":["a","b","c","d"],
"immovable_prop_details":["a","b ","c","d"],
"immovable_cost":["a","b","c","d"],
"immovable_present_value":["a","b","c","d"],
"immovable_owner":["a","b","c","d"],
"immovable_how_acquired":["a","b","c","d"],
"immovable_annual_income":["a","b","c","d"],
"immovable_remarks":["a","b","c","d"],
"add_subdivision":"e",
"add_prop_details":"e",
"add_cost":"e",
"add_present_value":"e",
"add_owner":"e",
"add_how_acquired":"e",
"add_annual_income":"e",
"add_remarks":"e "}"
}
我無法打印鍵的值和誠實,我不知道是否它是適當的JSON格式。任何幫助,高度讚賞。
EDITED 用於檢索使用Laravel是如下數據我的代碼:I印刷返回的對象使用
$data = Property::where("users_id","=",Input::get('user_id'))->select('immovable_property')->first();
return Response::json($data);
:
document.write(data.immovable_property);
其給出由JSONLint驗證輸出:
{
"immovable_subdivision": [
"a",
"b",
"c",
"d"
],
"immovable_prop_details": [
"a",
"b ",
"c",
"d"
],
"immovable_cost": [
"a",
"b",
"c",
"d"
],
"immovable_present_value": [
"a",
"b",
"c",
"d"
],
"immovable_owner": [
"a",
"b",
"c",
"d"
],
"immovable_how_acquired": [
"a",
"b",
"c",
"d"
],
"immovable_annual_income": [
"a",
"b",
"c",
"d"
],
"immovable_remarks": [
"a",
"b",
"c",
"d"
],
"add_subdivision": "e",
"add_prop_details": "e",
"add_cost": "e",
"add_present_value": "e",
"add_owner": "e",
"add_how_acquired": "e",
"add_annual_income": "e",
"add_remarks": "e "
}
使用[JSONLint(http://jsonlint.com/)來檢查你的JSON的有效性。 – ekad