我使用System.Json
解析JSON,如下所示:
JsonValue open_appts = api.GET("/appointments/open", search);
JsonValue appt = open_appts["appointments"][0];
Console.WriteLine("Open appointment:");
FindAppointmentSlot(appt);
private void FindAppointmentSlot(JsonValue appt)
{
try
{
foreach (var appointmentSlot in appt)
{
lblDate.Text = appointmentSlot.Value["date"][0].ToString();
lblAppointmentID.Text = appointmentSlot.Value["appointmentid"].ToString();
}
}
catch (Exception ex) { }
}
我需要将JSON值分配到textbox中。但是当我运行该程序时,它会显示错误:
错误:System.String' ' JsonType.String'的JsonValue不支持类型索引器。型
您的建议表示赞赏。