Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing Newtonsoft.Json #12

Closed
phongnguyend opened this issue Sep 15, 2021 · 0 comments
Closed

Removing Newtonsoft.Json #12

phongnguyend opened this issue Sep 15, 2021 · 0 comments

Comments

@phongnguyend
Copy link
Owner

phongnguyend commented Sep 15, 2021

How to migrate from Newtonsoft.Json to System.Text.Json

dotnet/core#5889 (comment)

Notes:

Newtonsoft.Json System.Text.Json
using Newtonsoft.Json; using System.Text.Json;
JsonConvert.DeserializeObject JsonSerializer.Deserialize
JsonConvert.SerializeObject JsonSerializer.Serialize
JsonSerializerSettings JsonSerializerOptions
Formatting.None JsonSerializerOptions.WriteIndented = false
Formatting.Indented JsonSerializerOptions.WriteIndented = true
default JsonSerializerOptions.PropertyNameCaseInsensitive = true
default JsonSerializerOptions.NumberHandling = JsonNumberHandling.AllowReadingFromString
JsonSerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver() JsonSerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.CamelCase
JsonSerializerSettings.ObjectCreationHandling = ObjectCreationHandling.Replace default
JsonSerializerSettings.NullValueHandling = NullValueHandling.Ignore JsonSerializerOptions.IgnoreNullValues = true
JsonSerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore JsonSerializerOptions.ReferenceHandler = ReferenceHandler.IgnoreCycles
JsonSerializerSettings.StringEscapeHandling= StringEscapeHandling.EscapeHtml default
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant