1.创建一个Account对象,并添加成员.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace JSONDemo
{
public class Account
{
public string Email { get; set; }
public bool Active { get; set; }
public DateTime CreateDate { get; set; }
}
}
2.反序列化Account对象,当其JSON字符串中与原对象成员不匹配时出现异常
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using GongHuiNewtonsoft.Json;
namespace JSONDemo
{
class Program
{
static void Main(string[] args)
{
string json = @"{
'Email':'359194966@qq.com',
'Actived':true,
'CreateDate':'2015-12-11 9:24:33',
'Roles':[
'Gon