Skip to content

Instantly share code, notes, and snippets.

@royto
Created September 26, 2014 12:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save royto/6fc4c9090dea1ebf22b9 to your computer and use it in GitHub Desktop.
Save royto/6fc4c9090dea1ebf22b9 to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Fdc.Web.Controllers.WebApi;
using Microsoft.Win32.SafeHandles;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using NUnit.Framework;
namespace Fdc.Web.Tests
{
[TestFixture]
public class Class1
{
[Test]
public void Deserialize()
{
using (var sr = new StreamReader("merge.json"))
{
var originJson = sr.ReadToEnd();
var mergeObj = JsonConvert.DeserializeObject<ProjectMerge>(originJson);
var jsonSerializerSettings = new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() };
var json = JsonConvert.SerializeObject(mergeObj, Formatting.Indented, jsonSerializerSettings);
using (var sw = new StreamWriter("merge.camelCase.json"))
{
sw.Write(json);
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment