当我在web服务中使用json时,它会显示以下数据,我只需要id和临时数据
当我在web服务中使用json获取数据时,它会显示以下数据,我只需要id和临时数据当我在web服务中使用json时,它会显示以下数据,我只需要id和临时数据,json,Json,当我在web服务中使用json获取数据时,它会显示以下数据,我只需要id和临时数据 { "0": "1", "1": "Travel Plan", "id": "1", "agenda_temp": "Travel Plan" }, { "0": "2", "1": "New Purchase", "id": "2", "agenda_temp": "New Purchase" }, { "0": "3", "1": "Get together", "
{
"0": "1",
"1": "Travel Plan",
"id": "1",
"agenda_temp": "Travel Plan"
},
{
"0": "2",
"1": "New Purchase",
"id": "2",
"agenda_temp": "New Purchase"
},
{
"0": "3",
"1": "Get together",
"id": "3",
"agenda_temp": "Get together"
},
这取决于编程语言,如果您使用Java,则可以使用以下代码:
JSONObject data = new JSONObject(your_JSON_Repsonse);
JSONArray data_Values=data.getJSONArray(Values);
for(int i=0;i<=data_Values.length();i++)
{
id=data_Values.getString("id");
agenda_temp=data_Values.getString("agenda_temp");
}
取决于用于处理接收到的json的编程语言。请添加详细信息和/或代码。虽然此代码可以回答问题,但提供有关此代码为什么和/或如何回答问题的其他上下文可提高其长期价值。
{
"Values": [
{
"0": "1",
"1": "Travel Plan",
"id": "1",
"agenda_temp": "Travel Plan"
},
{
"0": "2",
"1": "New Purchase",
"id": "2",
"agenda_temp": "New Purchase"
},
{
"0": "3",
"1": "Get together",
"id": "3",
"agenda_temp": "Get together"
}
]
}
$json = file_get_contents('data.json');
$data = json_decode($json,true);
// change the variable name to Values which is clearer.
$Values = $data['Values'];
foreach ($Values as $Value)
{
echo $Value['id'];
echo $Value['agenda_temp'];
}