tagged [json]

JSON.NET how to remove nodes

JSON.NET how to remove nodes I have a json like the following: I just want to trans

18 Apr at 13:52

JSON.Net get native type of value

JSON.Net get native type of value Using JSON.Net, how do I get the native type of a value in a JSON file? Namely, I'm after simply if it's a string (value enclosed in quotations) or not.

17 Feb at 15:7

System.Text.Json.JsonException: The input does not contain any JSON tokens

System.Text.Json.JsonException: The input does not contain any JSON tokens I'm just trying to use a Http POST method in a Blazor app through _http and myObject have been defined elsewhere, but I'm get...

Tell Json.Net to write a single-quote rather than a double quote when serializing objects

Tell Json.Net to write a single-quote rather than a double quote when serializing objects When calling `Newtonsoft.Json.JsonConvert.SerializeObject(myObject)` I'm getting keys and values enclosed in d...

10 Dec at 17:36

Find and return JSON differences using newtonsoft in C#?

Find and return JSON differences using newtonsoft in C#? I'd like to get a list of the JSON parts that don't match when doing a comparison using Newtonsoft. I have this code that compares: But can't f...

28 Jul at 15:20

How to Deserialize JSON data?

How to Deserialize JSON data? I am new to working with JSON data. I am reading data from a web service. The query data sent back is the following: ``` [["B02001_001E","NAME","state"], ["4712651","Alab...

how to return json error msg in asp.net web api?

how to return json error msg in asp.net web api? I would like to return a json errormessage but at the moment in fiddler I cannot see this in the json panel: ``` string error = "An error just happened...

24 Mar at 10:41

Servicestack json allow unquoted properties

Servicestack json allow unquoted properties Is it possible to tell servicestack to allow unquoted properties in JSON? I have a lot of JSON that I need to send to a service which doesn't have quoted pr...

30 Aug at 15:57

How do I deserialize an array of JSON objects to a C# anonymous type?

How do I deserialize an array of JSON objects to a C# anonymous type? I have no problem deserializing a single json object to a C# anonymous type: But when I have an array: ``` string jsonArray = @"[{...

30 Jan at 07:25

Json.Net And ActionResult

Json.Net And ActionResult Im building a JObject myself and want to return it as ActionResult. I dont want to create and then serialize a data object For example ``` public ActionResult Test(string id)...

6 Mar at 11:43

JSON_Spirit: mapping value.type() back to the type?

JSON_Spirit: mapping value.type() back to the type? You can display a Value's type like this: ``` cout

22 Apr at 00:54

How can I tell Json.NET to ignore properties in a 3rd-party object?

How can I tell Json.NET to ignore properties in a 3rd-party object? The Json.NET documentation says you use `JsonIgnore` to not serialize certain properties in your classes: How can I make Json.NET ig...

9 Sep at 16:18

Add Multiple Contract Resolver in Newtonsoft.Json

Add Multiple Contract Resolver in Newtonsoft.Json Blueprint for data structure: Using Newtonsoft.Json, I have the following configuration for Json serialization. Clearly that, this will print out:

30 Nov at 02:9

Json.net serialize/deserialize derived types?

Json.net serialize/deserialize derived types? json.net (newtonsoft) I am looking through the documentation but I can't find anything on this or the best way to do it. Now I have Derived objects in the...

20 Mar at 08:21

JObject nested property

JObject nested property I am trying to make a json object like this with JObject: I can add properties like: But any time I try to nest an object inside another object so I can have the parent "input"...

8 May at 14:22

json.net vs DataContractJsonSerializer

json.net vs DataContractJsonSerializer I know there's a DataContractJsonSerializer that comes now with the .net framework and is used by wcf ajax enabled services. However, I've noticed there's also a...

28 Jan at 09:42

Newtonsoft.Json SerializeObject without escape backslashes

Newtonsoft.Json SerializeObject without escape backslashes Given the code: The output is below: When debugging a large json document it is hard to read - using the built in features of Newtonsoft.Json...

1 Dec at 14:7

Deserialize anonymous type with System.Text.Json

Deserialize anonymous type with System.Text.Json I am updating some apps for .NET Core 3.x, and as part of that I'm trying to move from `Json.NET` to the new `System.Text.Json` classes. With Json.NET,...

Create Json dynamically in c#

Create Json dynamically in c# I need to create a Json object dynamically by looping through columns. so declaring an empty json object then add elements to it dynamically. eg: ``` List columns = new L...

16 Jan at 15:45

Getting the name / key of a JToken with JSON.net

Getting the name / key of a JToken with JSON.net I have some JSON that looks like this I parse this as a JArray: Then, I lo

8 Jan at 17:18

Deserialize JSON as object or array with JSON.Net

Deserialize JSON as object or array with JSON.Net I want to know if it is possible to deserialize a JSON object that could either be an object or an array. Similar to this question: [Jackson deseriali...

23 May at 12:0

How to write a JSON file in C#?

How to write a JSON file in C#? I need to write the following data into a text file using JSON format in C#. The brackets are important for it to be valid JSON format. Here is my model class: ``` publ...

28 Nov at 19:23

Additional text encountered after finished reading JSON content:

Additional text encountered after finished reading JSON content: I am having some problems with create with JSON.Net. When I try to parse it, it gives me following error: > Additional text encountered...

24 Jan at 20:6

Explanation of JSONB introduced by PostgreSQL

Explanation of JSONB introduced by PostgreSQL PostgreSQL just introduced [JSONB](http://www.depesz.com/2014/03/25/waiting-for-9-4-introduce-jsonb-a-structured-format-for-storing-json/) in version 9.4,...

Extract Values from JObject

Extract Values from JObject I'm trying to extract some values from a Json but I have problems with the data between [ ] for the first values I'm using: but when I'm

25 Aug at 20:34