日期:2014-05-17 浏览次数:20811 次
using System;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Json;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
var sw = new DataContractJsonSerializer(typeof(TB));
var str = File.ReadAllText("data.txt");
var obj = (TB)sw.ReadObject(new MemoryStream(Encoding.Unicode.GetBytes(str)));
var objn=obj.details;
Console.WriteLine("A的值为:{0}", objn[0].A[0][0]);
Console.ReadKey();
}
}
public class TB
{
public TA[] details { get; set; }
}
public class TA
{
public int[] A { get; set; }
public long datetime { get; set; }
public int[] B { get; set; }
public int[] C { get; set; }
public bool D { get; set; }
}
}
{
"details": [
{
"A": [
[
"老王",
"70岁"
],
[
"老李",
"83岁"
]
],
"DataTime": 1389542400000,
"B": [
0,
&nb