我有一个包含这样内容的json文件
{
start_date: "2018-03-19 09:00",
end_date: "2018-03-19 11:00",
text: "Plan: Make New Server",
description: "Setup Apache",
section_id: 'mobilepay',
person: "peterpaul,janelane",
progress: "",
state: "plan",
delay: "",
type: "task"
},
我怎样才能获得" person"的价值?通过javascript是peterpaul和janelane?
我需要将这些值添加为img标记中的src值
答案 0 :(得分:1)
你可能想把它变成一个javascript问题。这回答了吗?
var obj = JSON.parse('{ "start_date": "2018-03-19 09:00", ... "person": "peterpaul,janelane", ... }');
alert(obj['person']);
分别获取人员的部分
var separateParts = obj['person'].split(',');