Deserialization is the process by which an object is recreated from its serialized state.
Questions tagged [deserialization]
7954 questions
33
votes
4 answers
How do I deserialize a JSON array using Newtonsoft.Json
[
{
"receiver_tax_id":"1002",
"total":"6949,15",
"receiver_company_name":"Das Company",
"receiver_email":"info@another.com",
"status":0
},
{
"receiver_tax_id":"1001",
"total":"39222,49",
…

Steven
- 439
- 1
- 4
- 10
33
votes
5 answers
SignalR : use camel case
I would like to know if there is a way to configure SignalR so that the client functions in the hub return objects using camel case.
Thanks.

dafriskymonkey
- 2,189
- 6
- 25
- 48
33
votes
2 answers
How to output Json string as JsonResult in MVC4?
This seems so simple I must be over-thinking it.
TL;DR;
How can I modify the code below to return the json object contained in the string rather than a string that happens to contain json?
public ActionResult Test()
{
var json_string = "{…

longda
- 10,153
- 7
- 46
- 66
32
votes
3 answers
No parameterless constructor defined for type of 'System.String' during JSON deserialization
This seems like it should be so easy, but I am getting an exception when I try to deserialize some straightforward JSON into a managed type. The exception is:
MissingMethodException
No parameterless constructor defined for type of…

Justin R.
- 23,435
- 23
- 108
- 157
32
votes
1 answer
Jackson Annotations: Difference Between JsonIgnoreProperties(ignoreUnknown=true) and JsonInclude(Include.NON_EMPTY)
I'm curious is there a difference between Jackson annotations @JsonIgnoreProperties(ignoreUnknown=true) and @JsonInclude(Include.NON_EMPTY) at the class level? Is one just a newer version of the other? Thanks!
The jackson docs state that:…

rsmets
- 789
- 1
- 13
- 23
32
votes
3 answers
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": false
},{
"prop1": "string",
"prop2": "string",
…

user3574076
- 711
- 1
- 6
- 23
32
votes
3 answers
How to get property from dynamic JObject programmatically
I'm parsing a JSON string using the NewtonSoft JObject.
How can I get values from a dynamic object programmatically?
I want to simplify the code to not repeat myself for every object.
public ExampleObject GetExampleObject(string…

dcdroid
- 672
- 2
- 9
- 29
32
votes
2 answers
Serializing groovy map to string with quotes
I'm trying to persist a groovy map to a file. My current attempt is to write the string representation out and then read it back in and call evaluate on it to recreate the map when I'm ready to use it again.
The problem I'm having is that the…

Doug Harris
- 3,169
- 5
- 29
- 31
31
votes
1 answer
Jackson custom deserializer for one field with polymorphic types
Update:
I tried to debug in jackson source code and find out that in the method
deserialize(JsonParser jp, DeserializationContext ctxt) of
SettableBeanProperty.java
when the _valueTypeDeserializer isn't null, it will never use _valueDeserializer.…

xi.lin
- 3,326
- 2
- 31
- 57
31
votes
6 answers
Direct self-reference leading to cycle exception
I have a class; something like the following:
public abstract class ElasticSearchValue {
private Long txId;
private Long currentTxId;
private T previous;
public Long getTxId() {
return txId;
}
public void setTxId(Long txId) {
…

Global Warrior
- 5,050
- 9
- 45
- 75
30
votes
5 answers
Deserialize array of key value pairs using Json.NET
Given the following json:
[ {"id":"123", ... "data":[{"key1":"val1"}, {"key2":"val2"}], ...}, ... ]
that is part of a bigger tree, how can I deserialize the "data" property into:
List Data { get; set; }
or
List Data {…

pbz
- 8,865
- 14
- 56
- 70
30
votes
1 answer
.NET Deserializing JSON to multiple types
Possible Duplicate:
Deserializing JSON into one of several C# subclasses
I have read-only access following JSON schema:
{ items: [{ type: "cat", catName: "tom" }, { type: "dog", dogName: "fluffy" }] }
I would like to deserialize each of these to…

nullable
- 2,513
- 1
- 29
- 32
29
votes
4 answers
System.Text.Json - Deserialize nested object as string
I'm trying to use the System.Text.Json.JsonSerializer to deserialize the model partially, so one of the properties is read as string that contains the original JSON.
public class SomeModel
{
public int Id { get; set; }
public string Name {…

kyrylomyr
- 12,192
- 8
- 52
- 79
29
votes
3 answers
Posting array of objects with MVC Web API
I have a basic post operation that works on a single object of RecordIem.
What I would like to do is do the same action but in bulk by posting an array of requests using the same format.
For instance:
public HttpResponseMessage Post(RecordItem…

brimble2010
- 17,796
- 7
- 28
- 45
29
votes
1 answer
JSON.NET deserialize to object with Type parameter
I have the following problem which I am unable to solve:
I have different classes which all implement an interface named IProtocol. The are named, for now, SimpleProtocol, ParallelProtocol. I wanted to persist those object so I used JSON.NET and…

avanwieringen
- 2,404
- 3
- 21
- 28