Deserialization is the process by which an object is recreated from its serialized state.
Questions tagged [deserialization]
7954 questions
3
votes
2 answers
Using JSON.NET to deserialize a list whose type is an interface
I have a "wrapper"-class for a list that contains different types of events. The list itself therefore uses a general "AnEvent" interface instead of a concrete type.
public class EventLog
{
[JsonProperty()]
private List events;
…

ceran
- 1,392
- 1
- 17
- 43
3
votes
3 answers
C# Generic method as extension with where clause
I want to create an extension which can run only for Serializable classes.
Is there a code like this:
using System;
namespace ConsoleApplication2
{
[Serializable]
public class Ser
{
}
public class NonSer
{
}
…

uzay95
- 16,052
- 31
- 116
- 182
3
votes
2 answers
How to serialize and deserialize a RSA KeyPair in Java
I wanted to implement some VERY basic security in my Java application, but I'm getting stuck at the very beginning.
What I want to do is this:
1-Generate a RSA keypair
2-Store those keys in my DB in serialized form, so I can re-create them on the…

Master_T
- 7,232
- 11
- 72
- 144
3
votes
1 answer
Jackson Polymorphic Deserialisation (where the class depends on the JSON key)
TL;DR
basically, my problem is that i have a list of wrapper objects
{"stuff": [
{"foobar" : {someObjectOfTypeA}},
{"barfoo" : {someObjectOfTypeB}},
{"foobar" : {someObjectOfTypeA}}
]}
and the type of someObjectOfTypeX depends on the value of…

stefs
- 18,341
- 6
- 40
- 47
3
votes
1 answer
json.net is throwing an error on serializing and deserializing a very simple class
I'm taking my first serious foray into working with Json and returning it from one application to another.
My application is an ASP.NET MVC 3 application using the .Net 4.0 Framework.
I need to serialize and deserialize a very simple class to and…

jason
- 2,219
- 5
- 33
- 66
3
votes
1 answer
Deserialization order over the inheritance tree
I have a base class marked Serializable, and derived classes marked Serializable too. I want to do something in the base class during deserialization, and therefore declared a method marked OnDeserializing, but it's important that this method will…

RoadBump
- 733
- 7
- 16
3
votes
3 answers
Java partial (de)serialization of objects
Let's say we have 3 Classes:
class foo { // not a singleton
String s;
}
class bar {
foo f;
int i;
}
class baz {
foo sameF;
}
Now we create instances
foo onlyFoo = new foo("the only one");
bar theBar = new bar(onlyFoo, 123);
baz…
user1563700
3
votes
1 answer
JSON.NET exception when deserializing an array of GUIDs
I'm using JSON.NET to deserialize AJAX HTTP requests sent in from the browser, and am running into problems with web service calls that use a Guid[] as a parameter. This worked fine when I used the built in .NET serializer.
First off, the raw bytes…

Mike Christensen
- 88,082
- 50
- 208
- 326
3
votes
2 answers
C# deserialize dynamic JSON
I have the following Json string that I need to deserialize.
{"123456789":
{"short_description":"Delivered",
"detail_description":"Your item has been delivered"
}
}
The first field "123456789" is an id number, so basically this value can…

There is no spoon
- 1,775
- 2
- 22
- 53
3
votes
1 answer
Why is my json deserialization failing?
I have the following two objects (which I do not control and can not change):
[Serializable]
[DataContract]
public class AddressContactType : BaseModel
{
public AddressContactType();
[DataMember]
public string AddressContactTypeName {…

Jason
- 463
- 1
- 11
- 25
3
votes
1 answer
getting a "default" concrete class that implements an interface
I am implementing a custom (and generic) Json.net serializer and hit a bump in the road that I could use some help on.
When the deserializer is mapping to a property that is an interface, how can I best determine what sort of object to construct to…

Roger Joys
- 320
- 1
- 3
- 11
3
votes
3 answers
Deserializing System.Drawing.Color Values - Built-In Method?
I would like to know if there is a method already part of the .Net Framework for instantiating a Color value from a string containing an RGB triplet such as the following:
"166, 103, 208"
If a Color is stored in my application's app.config, it's…

Charlie Salts
- 13,109
- 7
- 49
- 78
3
votes
3 answers
JSON.Net, JsonConvert.DeserializeObject - problems with deserialization
When I am trying to deserialize my JSON with JSON.Net it gives me invalid values for JSON arrays.
I have simple JSON:
[
{
"PhaseName": "Start",
"Advices": ["Lorem ipsum dolor",
"Lorem ipsum dolor",
"Lorem ipsum dolor"]
},
{
…

Alex
- 33
- 1
- 3
3
votes
3 answers
how to deserialize a python printed dictionary?
I have python's str dictionary representations in a database as varchars, and I want to retrieve the original python dictionaries
How to have a dictionary again, based in the str representation of a dictionay?
Example
>>> dic = {u'key-a':u'val-a',…

jperelli
- 6,988
- 5
- 50
- 85
3
votes
1 answer
Force WCF to use a existing buffers during Deserialization?
I looked for some other topics here as well, but I didn't find a solution to my problem yet.
Imagine the following:
I've a very simple ServiceContract with different OperationContracts. One of these OperationContracts is a simple use-case "download…

Marcel N
- 35
- 3