Skip to content

Magenaut

  • Home
  • Topics
    • Notes
    • Tutorial
    • Bug fixing
    • Extension
    • Server
  • Q&A
  • Privacy Policy
  • About

json.net

Force CamelCase on ASP.NET WebAPI Per Controller

September 2, 2022 by Magenaut

In ASP.NET WebAPI, I know you can set the default json formatter to use camel case using CamelCasePropertyNamesContractResolver() in the global.aspx which will force ALL json serialization to camel case.

Categories ASP.NET, Q&A Tags asp.net, asp.net-web-api, camelcasing, json, json.net Leave a comment

Can you tell JSON.Net to serialize DateTime as Utc even if unspecified?

September 2, 2022 by Magenaut

Dates in my database are stored as Utc. But when I retreieve them w/ the entity framework they come out as type unspecified.

Categories ASP.NET, Q&A Tags asp.net, entity-framework, javascript, json.net Leave a comment

Is there a way in Json.NET serialization to distinguish between “null because not present” and “null because null”?

September 2, 2022 by Magenaut

I’m working in an ASP.NET webapi codebase where we rely heavily on the automatic support for JSON deserialization of message bodies into .NET objects via JSON.NET.

Categories ASP.NET, Q&A Tags asp.net, asp.net-web-api, c#, json, json.net Leave a comment

How to make Json.Net skip serialization of empty collections

August 31, 2022 by Magenaut

I have an object that contains several properties that are a List of strings List<String> or a dictionary of strings Dictionary<string,string>. I want to serialize the object to json using Json.net and I want to have the least amount of text generated.

Categories ASP.NET, Q&A Tags asp.net, c#, json.net, serialization Leave a comment

json.net; serialize entity framework object (circular reference error)

August 31, 2022 by Magenaut

I have an entity framework entity that i want to serialize as a json object. I looked around and found out that json.net (http://james.newtonking.com/projects/json-net.aspx) should be able to serialize objects with circular references “out of the box”. So i tried using

Categories ASP.NET, Q&A Tags asp.net, c#, entity-framework, json.net Leave a comment

Automatically bind pascal case c# model from snake case JSON in WebApi

August 30, 2022 by Magenaut

I am trying to bind my PascalCased c# model from snake_cased JSON in WebApi v2 (full framework, not dot net core).

Categories ASP.NET, Q&A Tags asp.net, asp.net-web-api2, c#, json.net Leave a comment

Exclude a type from model validation (example DbGeography) to avoid InsufficientExecutionStackException

August 30, 2022 by Magenaut

UPDATE: for the tl;dr version skip to the bottom

Categories ASP.NET, Q&A Tags asp.net, asp.net-web-api, c#, json.net Leave a comment

Parse json string using JSON.NET

August 29, 2022 by Magenaut

I have a string like the following in C#. I need to loop through and create an HTML table output. I tried with JSON.NET but couldn’t figure out how to retrieve the keys (Name, Age & Job).

Categories ASP.NET, Q&A Tags asp.net, c#, json, json.net Leave a comment

how to force netwtonsoft json serializer to serialize datetime property to string?

August 29, 2022 by Magenaut

I am using Newtonsoft’s Json
when i serialze a date time property i get the json response as:

Categories ASP.NET, Q&A Tags asp.net, c#-4.0, json.net Leave a comment

‘Newtonsoft.Json…’ exists in both ‘BlendNewtonsoft.Json.dll’ and ‘Solutionpackages…

August 29, 2022 by Magenaut

I’m not able to build the solution in Visual Studio 2013.

Categories ASP.NET, Q&A Tags .net, asp.net, c#, json.net, visual-studio Leave a comment
Older posts
Newer posts
← Previous Page1 Page2 Page3 Page4 Next →
  1. michealSmith07 on Is there a way to dynamically refresh the less command?August 21, 2022

    That is a very nice post. I like this post.

  2. anonymous on Fix libwacom9 dependency issue when upgrade DebianJune 27, 2022

    saved my day!! Thanks for the help…

  3. sreedhar on Fix libwacom9 dependency issue when upgrade DebianMay 10, 2022

    Thanks its working

  4. saintnick on Fix libwacom9 dependency issue when upgrade DebianMay 10, 2022

    remove libwacom2 worked for me as well

  5. ranafoul on Fix libwacom9 dependency issue when upgrade DebianApril 22, 2022

    apt remove libwacom2 helped on kali 2022.01. gr8

.net ajax asp.net asp.net-core asp.net-mvc asp.net-mvc-3 asp.net-mvc-4 asp.net-web-api bash c# command-line css custom-post-types custom-taxonomy dataframe dictionary django entity-framework functions gridview html iis javascript jquery json linux list matplotlib numpy pandas php plugin-development plugins posts python python-2.7 python-3.x security shell shell-script sql string vb.net webforms wp-query

© 2026 Magenaut • Built with GeneratePress