tagged [json]

Finding a node (JObject) within JArray using JSON.NET library

Finding a node (JObject) within JArray using JSON.NET library I am using JSON.NET library. I have created few JObjects and added them to a JArray. ``` JArray array = new JArray(); JObject obj = new JO...

2 Nov at 16:55

How to force System.Text.Json serializer throw exception when property is missing?

How to force System.Text.Json serializer throw exception when property is missing? Json.NET behaviour could be defined by attributes: either use default or just throw an exception if json payload does...

How to use custom reference resolving with JSON.NET

How to use custom reference resolving with JSON.NET I have the following JSON: And I want to match it to this object: ``` public class Item { [JsonProperty(PropertyName = "categoryId")] public

12 Feb at 18:47

How to cast JObject in JSON.Net to T

How to cast JObject in JSON.Net to T I know that I can use `JsonConvert.DeserializeObject(string)`, however, I need to peek into the object's `_type` (which may not be the first parameter) in order to...

22 Nov at 14:53

Could not determine JSON object type for type "Class"

Could not determine JSON object type for type "Class" I got the following error while trying to add an object of type class to the . > Could not determine JSON object type for type "Class" Here is my ...

20 Apr at 13:26

Json Datetime issue

Json Datetime issue > [how to force netwtonsoft json serializer to serialize datetime property to string?](https://stackoverflow.com/questions/7670629/how-to-force-netwtonsoft-json-serializer-to-seri...

14 Aug at 20:30

Generating newlines instead of CRLFs in Json.Net

Generating newlines instead of CRLFs in Json.Net For my unix/java friends I would like to send newlines ('\n') instead of a CRLF ( '\r\n') in Json.Net. I tried setting a StreamWriter to use a newline ...

7 Aug at 10:18

Json.NET adding backslash while returning json serialized string

Json.NET adding backslash while returning json serialized string I am trying to serialize a list to json string using Json.NET but the return string has backslash within it, which in turn is failing a...

14 Aug at 07:45

JSON and XML comparison

JSON and XML comparison I want to know which is faster: XML and JSON? When to use which one ?

9 Sep at 20:22

How do you represent a JSON array of strings?

How do you represent a JSON array of strings? This is all you need for valid JSON, right?

14 Mar at 00:33

How to prettyprint a JSON file?

How to prettyprint a JSON file? How do I pretty-print a JSON file in Python?

10 Apr at 10:24

What does ReferenceLoopHandling.Ignore in Newtonsoft.json exactly do?

What does ReferenceLoopHandling.Ignore in Newtonsoft.json exactly do? Can anyone present me a scenario where it can be used. What I understand by is if you have an object A which references object B a...

21 Jul at 10:3

Deserialize nested JSON into C# objects

Deserialize nested JSON into C# objects I am getting JSON back from an API that looks like this: ``` { "Items": { "Item322A": [{ "prop1": "string", "prop2": "string", "prop3": 1, "prop4...

How can I "un-JsonIgnore" an attribute in a derived class?

How can I "un-JsonIgnore" an attribute in a derived class? I am using [Newtonsoft's JsonSerializer](http://www.newtonsoft.com/json) to serialise some classes. As I wanted to omit one field of my class...

23 Feb at 12:46

Add new attribute (element) to JSON object using JavaScript

Add new attribute (element) to JSON object using JavaScript How do I add new attribute (element) to JSON object using JavaScript?

26 Mar at 08:49

Serialize to JSON in .NET 2.0

Serialize to JSON in .NET 2.0 how can you serialize an object to JSON in .NET 2.0 using C#?

29 Jun at 00:57

Json.net deserialization null guid case

Json.net deserialization null guid case I'm deserializing an object using `Json.NET` that contains a private field of type Guid and a public property for that field. When the value for my `Guid` is nu...

31 Jul at 16:27

Retuning JObject\dynamic with ServiceStack seems to return

Retuning JObject\dynamic with ServiceStack seems to return I'm trying to take a JSON string from SQL (works fine with SQL json queries, it's stuctured fine in there) and return it through ServiceStack...

5 Jul at 13:59

How to avoid the ROOT Element when parsing from XML to JSON in C#

How to avoid the ROOT Element when parsing from XML to JSON in C# I am trying to create a JSON from an xml using JSON.NET OUTPUT JSON

11 Oct at 06:11

"EF BB BF" at the beginning of JSON files created in Visual Studio

"EF BB BF" at the beginning of JSON files created in Visual Studio I have a bunch of `JSON` files set as `Embedded resource` in one of my projects. I'm using `Newtonsoft.Json` to parse these files: ``...

21 May at 15:0

How can I convert JToken to string[]?

How can I convert JToken to string[]? I am trying to read an array from a JObject into a string[] but I cannot figure out how. The code is very simple as below but does not work. Fails with error cann...

14 Jan at 08:16

Can comments be used in JSON?

Can comments be used in JSON? Can I use comments inside a [JSON](https://en.wikipedia.org/wiki/JSON) file? If so, how?

5 Jul at 00:35

Reverse of JSON.stringify?

Reverse of JSON.stringify? I'm stringyfing an object like `{'foo': 'bar'}` How can I turn the string back to an object?

16 Dec at 09:24

How to create a JSONObject from String in Kotlin?

How to create a JSONObject from String in Kotlin? I need to convert a string `{\"name\":\"test name\", \"age\":25}` to a JSONObject

31 May at 22:36

Why can't I add the newtonsoft.Json.dll ref to my project?

Why can't I add the newtonsoft.Json.dll ref to my project? I am trying to add a reference 'Newtonsoft.Json.dll' I have followed what he has asked. which adds this ref from 'browse' tab to 'recent' tab...