Created
September 26, 2014 12:25
-
-
Save royto/6fc4c9090dea1ebf22b9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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