bitScry

  • Home
  • About
  • Blog
  • Contact

Newtonsoft

About this site

This is a blog to help me remember some of the coding challenges I’ve faced and hopefully help others out if they’re suffering the same problems.

Recent Posts
  • Mocking Hangfire BackgroundClient Jobs
  • Running Shinobi CCTV on a Raspberry Pi
  • Visual Studio CoreCLR Error
  • Adding Healthchecks to a .NET Core 6 API
  • Getting Location From IP Address
Tag Cloud

.NET .NET Core AAD API appsettings.json ASP.NET Core Authentication Azure Azure Active Directory Azure Function Azure Storage Blob Bootstrap C# Cloud Storage Console Application CSS CSV DataTable Dependency Injection Dictionary Enum Extension Google GZip HTML Image JavaScript jQuery JSON List MVC MVC 6 Newtonsoft RestSharp Serilog SFTP SQL Stored Procedure Stream Table Table Storage Web App Web Application WordPress

Programming

Pascal Case Naming in Newtonsoft

When serializing object to JSON using Newtonsoft it’s possible to change the naming of the properties by updating the serializer naming conventions as detailed here. It’s also possible to create your own custom naming strategy if none of the inbuild ones do the dop. This can be done by inheriting Read more…

By Shinigami, 10 months20 October 2021 ago
Programming

JsonResult Serializer Settings in .NET Core3.1

If you are returning a JSON representation of an object from an MVC controller it may be necessary to determine how the JSON is formatted. This can be done using the JsonSerializerSettings object like so. This used to work as is with version 2 of .NET Core but with the Read more…

By Shinigami, 2 years20 July 2020 ago
Programming

Serializing JSON Values Without Quotes

I have a package called ChartJSCore which generates the required JavaScript for creating Chart.js charts in a web application. For the most part the JS for this is essentially JSON so this works by serializing chart objects using Newtonsoft which automatically quotes both the object name and value. However, some Read more…

By Shinigami, 5 years23 October 2017 ago
Programming

Single or Array Enum JSON Converter

In addition to the SingleOrArrayConverter mentioned previously I’ve also created a version to translate enums to/from JSON using the name of the enum rather than it’s value as is the default.

By Shinigami, 5 years6 September 2017 ago
Programming

Single or Array JSON Converter

Often APIs will have actions where one of the parameters can be either a single object or an array of objects, in order to correctly serialize objects to JSON which can be accepted by the API a custom JsonConverter is needed. This code is borrowed from this stack overflow article. Read more…

By Shinigami, 5 years31 August 2017 ago
  • Facebook
  • Twitter
  • Instagram
  • Email
Hestia | Developed by ThemeIsle