Created
February 28, 2016 21:01
-
-
Save panesofglass/54d94949f53d1381712f to your computer and use it in GitHub Desktop.
Server MVC OWIN Formatting
This file contains 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
open Newtonsoft.Json | |
let serializerSettings = JsonSerializerSettings(ContractResolver = Serialization.CamelCasePropertyNamesContractResolver()) | |
serializerSettings.Converters.Add(OptionConverter()) | |
let serialize data = | |
JsonConvert.SerializeObject(data, serializerSettings) | |
|> Text.Encoding.UTF8.GetBytes | |
let deserialize<'T> (stream: Stream) = | |
let reader = new StreamReader(stream) | |
let body = reader.ReadToEnd() | |
JsonConvert.DeserializeObject<'T>(body, serializerSettings) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment