This tag can be used when you want to convert any text, objects or other formats into a JSON object,or if you want to transform a JSON object into something else.
Questions tagged [jsonconvert]
207 questions
1
vote
1 answer
MaxJsonLength error in NewtonSoft JsonConvert.SerializeObject
I have a ASP.NET project, with some AJAX calling a webmethod, that would return JSON.
If the DataSet has about 100 lines, there is no problem. But with 1000 lines, it launch the error:
Error during serialization or deserialization using JSON…

Lucas Anschau
- 91
- 1
- 9
1
vote
3 answers
C# Parsing JSON using JObject.Parse to ignore missing fields
Is it possible to have JObject.Parse ignore missing fields?
From my example below you can see that I have declared a class Address and using JsonProperty to specifying alternate field names.
I have provided 3 examples, there are 3 JSON strings which…

iggyweb
- 2,373
- 12
- 47
- 77
1
vote
0 answers
Deserialize Json Object having double quoted string
I want to deserialize a JSON string that has double quoted string as mentioned below.
Json:
string jsonString = "{\"Name\": 2, \"Description\": \"The \"test\" description\"}";
Target Class:
public class TestClass
{
public string Name { get;…

Anadi
- 744
- 9
- 24
1
vote
1 answer
Why is JsonConvert throwing exception when deserializing to a dictionary
I have an issue serializing a JSON string to a key/value dictionary. The code is like:
var parameters = "{\"id\":123}";
JsonConvert.DeserializeObject>(parameters);
This example seems work perfectly, giving me…

Bas Slagter
- 9,831
- 7
- 47
- 78
0
votes
0 answers
get enumMember value property from an enum
I have an enum like this :
[JsonConverter(typeof(StringEnumConverter))]
public enum Process
{
[EnumMember(Value = "N/A")]
None,
[EnumMember(Value = "Something")]
Something
}
When I try to read…

schwifty
- 145
- 1
- 12
0
votes
1 answer
How to fetch Json string from Database and assign it to grid view row textboxes
I have dynamic grid row textboxes, i add values and save, it gets serialized into json format and gets saved in database, now when i have to populate the grid(when i refresh)the saved data needs to be displayed on the textboxes.
My code:
foreach…

Freshernoob
- 11
0
votes
1 answer
Getting a java runtime exception while converting a an entity using gson
I am trying to convert an object to another using gson. while converting the gson getting a runtime exception saying: "unable to invoke no-args constructor for interface java.sql.clob. Registering an instancecreator with gson for this type may fix…

kavya
- 157
- 2
- 10
0
votes
2 answers
How to remove "Double braces {{}}" in a property of dynamic type during deserialization (ASp.Net Core MVC)
When deserializing a string, the curly braces are duplicating and this is disturbing the reading of some fields. I've tried everything, but I can't serialize correctly, without duplicate curly braces.
I already tried to do it like this:
dynamic…

masterj
- 67
- 6
0
votes
0 answers
How to use JsonConvert.DeserializeObject method without StringEscapeHandling
I use this method to process data from api, I want it to not escape special characters but keep special characters like '\n'.
I found it escapes special characters like \n even in default mode. Is there a way to turn off the default…

frank
- 1
- 2
0
votes
1 answer
How to decode json data with Reified, Generics, Interface and Kotlin?
How to decode json data with Reified, Generics, Interface and Kotlin?
I created a project where i put the code and the instructions to run:
https://github.com/paulocoutinhox/kotlin-gson-sample
But basically the code is:
import…

Paulo Coutinho
- 5
- 2
0
votes
2 answers
Make custom file format a json file
I'm trying to convert a custom file to JSON for easy editing. Here is the custom code example:
{
"#letter_a" "A"
"#letter_b" "B"
"#letter_c" "C"
"#letter_d" "D"
"#letter_e" "E"
"#letter_f" "F"
"#letter_g" "G"
…

CidQu
- 412
- 6
- 13
0
votes
0 answers
Trying to get data from firebase but it shows Json error"Could not cast or convert" c#
I am trying to get data from firebase but it shows an error "Could not cast or convert from System.String to System.Collections.Generic.Dictionary`2"
This is my code:
IFirebaseConfig config = new FirebaseConfig()
{
AuthSecret = "Auth",
…

Jeff Li
- 3
- 1
0
votes
1 answer
Getting Collection text while serializing List inside a Dictionary using JsonConvert in C#
So I have the following data structure defined in my program:
Dictionary, int>> myTopDict = new Dictionary, int>>();
Dictionary
- , int> myInnerDict = new…

Rahul Sharma
- 7,768
- 2
- 28
- 54
0
votes
0 answers
How to deserialize an abstract class?
I'm doing a little application where to upload a json file and deserialize its content into objects. My problem is that I have an abstract class. I made a JsonConverter but I don't know how should I call it to make a correct deserialization.
My…

Weenhallo
- 324
- 2
- 8
0
votes
0 answers
DateTime property doesn't Deserialize. Other DateTime properties in the same model work fine
I have 3 DateTime properties in my ViewModel, which is used to generate a report using jqxgrid. The report is correctly generated with all the columns showing. The report can be exported to excel using jqxgrid's 'exportdata' method. The Json that…

RonCitrus
- 19
- 3