日期:2014-05-16 浏览次数:20394 次
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Converters;
namespace WindowsFormsApplication3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string str = "{detail:[ {id:1,name: 'abc',code:'haha'},{id:2,name: 'abc1',code:'haha1'},{id:3,name: 'abc1',code:'haha1'} ]}";
JObject obj = JObject.Parse(str);
//Console.WriteLine(obj["detail"].ToString());
JArray json = (JArray)obj["detail"];
for (int j&nbs