一、序列化没有任何格式或空格缩进的对象
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; }
public IList<string> Roles { get; set; }
}
}
2. 序列化没有任何格式或空格缩进的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)
{
Account account = new Account
{
Email = "359194966@163.com",
Active = true,
CreateDate = new DateTime(2015, 12, 10, 0, 0, 0,