Questions tagged [deserialization]

Deserialization is the process by which an object is recreated from its serialized state.

7954 questions
42
votes
4 answers

Jackson Change JsonIgnore Dynamically

I have a class and there are variables inside it as well. Sometimes I want to ignore some fields and sometimes not when deserializing (maybe at serializing too). How can I do it at Jackson?
kamaci
  • 72,915
  • 69
  • 228
  • 366
41
votes
11 answers

jQuery deserialize form

I am using jQuery Serialize to serialize my form elements and would like to deserialize them back. Unfortunately can't find any working jQuery deserializer, any suggestions?
Tomas
  • 17,551
  • 43
  • 152
  • 257
41
votes
3 answers

Issue with JSON.stringify adding a extra \ and "" to my Json object

Hi I am creating using Javascript an array of object with a key and a value using the following code. ValuesArray.push({ key: $(this).attr('someattribute'), value: $(this).val() }); As a result I have am array of object like this: key:29; value:…
Devsined
  • 3,363
  • 6
  • 30
  • 48
40
votes
7 answers

cannot deserialize from Object value (no delegate- or property-based Creator) even with default constructor present

I have a class that looks like class MyClass { private byte[] payload; public MyClass(){} @JsonCreator public MyClass(@JsonProperty("payload") final byte[] payload) { this.payload = payload; } public byte[]…
krackoder
  • 2,841
  • 7
  • 42
  • 51
40
votes
4 answers

Deserialize millisecond timestamp to java.time.Instant

I'm attempting to read a JSON file using Jackson and store one of the fields that is stored as a epoch milliseconds as a Java Instant, however deserialization is not behaving as expected. Here is what I am seeing when trying to read the…
Marquis Blount
  • 7,585
  • 8
  • 43
  • 67
40
votes
12 answers

How do I deserialize a complex JSON object in C# .NET?

I have a JSON string and I need some help to deserialize it. Nothing worked for me... This is the JSON: { "response": [{ "loopa": "81ED1A646S894309CA1746FD6B57E5BB46EC18D1FAff", "drupa":…
Assaf Zigdon
  • 461
  • 2
  • 5
  • 9
40
votes
3 answers

Jackson - How to specify a single implementation for interface-referenced deserialization?

I want to deserialize a JSON-Object with Jackson. Because the target is an interface I need to specify which implementation should be used. This information could be stored in the JSON-Object, using @JsonTypeInfo-Annotation. But I want to specify…
Max Schmidt
  • 7,377
  • 5
  • 23
  • 29
39
votes
1 answer

How can I deserialize JSON with a top-level array using Serde?

I have a some JSON data that is returned from a web service. The JSON is a top-level array: [ { "data": "value1" }, { "data": "value2" }, { "data": "value3" } ] Using serde_derive to make structs I…
Noskcaj
  • 633
  • 1
  • 8
  • 10
38
votes
4 answers

Parsing large JSON file in .NET

I have used the "JsonConvert.Deserialize(json)" method of Json.NET so far which worked quite well and to be honest, I didn't need anything more than this. I am working on a background (console) application which constantly downloads the JSON content…
Yavar Hasanov
  • 513
  • 1
  • 6
  • 12
38
votes
2 answers

Serialization - readObject writeObject overrides

Having written the code below I now have to,use custom readObject() and writeObject() override methods in StudentData to read and write the object's variables. Without using the defaultWriteObject or defaultReadObject methods to do this. The trouble…
Quinn
  • 577
  • 2
  • 6
  • 14
37
votes
6 answers

Deserializing a JSON file with JavaScriptSerializer()

the json file's structure which I will deserialize looks like below; { "id" : "1lad07", "text" : "test", "url" : "http:\/\/twitpic.com\/1lacuz", "width" : 220, "height" : 84, "size" : 8722, "type" : "png", "timestamp"…
tugberk
  • 57,477
  • 67
  • 243
  • 335
37
votes
2 answers

Golang serialize and deserialize back

What's the best way (completeness and performance) in Golang to serialize and deserialize a struct to string and vice versa? for example, if I have this struct: struct Session { Properties map[string]interface{} Permissions []int64 } I want…
Kokizzu
  • 24,974
  • 37
  • 137
  • 233
36
votes
3 answers

Newtonsoft Json Error converting value {null} to type 'System.Int32'

When performing an AJAX request I am getting the following error: Error converting value {null} to type 'System.Int32'. Path '[5].tabID', line 1, position 331. The error occurs on the second line of my processRequest (...) public void…
elementzero23
  • 1,389
  • 2
  • 16
  • 38
35
votes
5 answers

Checking if a stream is empty

I am trying to deserialize a XML-file. I need to check if the XML-file stream is empty before tying to deserialize it. IsolatedStorageFileStream isfs1 = new IsolatedStorageFileStream("test.xml", FileMode.Open, FileAccess.Read, isf); //…
Erik
  • 1,285
  • 2
  • 12
  • 10
35
votes
7 answers

How to resolve deserialization error in delayed job?

I am trying to use DelayedJob and the job is failing, giving the following error in the database: {Delayed::DeserializationError /Library/Ruby/Gems/1.8/gems/delayed_job-2.1.3/lib/delayed/serialization/active_record.rb:7:in…
deruse
  • 2,851
  • 7
  • 40
  • 60