Questions tagged [serialization]
Serialization is the process by which data-structures are converted into a format that can be easily stored or transmitted and subsequently reconstructed.
31,767
questions
3272votes
26answers
1.0mviews
What is a serialVersionUID and why should I use it?
Eclipse issues warnings when a serialVersionUID is missing.
The serializable class Foo does not declare a static final
serialVersionUID field of type long
What is serialVersionUID and why is ...
1889votes
40answers
2.2mviews
How can I display a JavaScript object?
How do I display the content of a JavaScript object in a string format like when we alert a variable?
The same formatted way I want to display an object.
1717votes
59answers
1.1mviews
Convert form data to JavaScript object with jQuery
How do I convert all elements of my form to a JavaScript object?
I'd like to have some way of automatically building a JavaScript object from my form, without having to loop over each element. I do ...
1229votes
11answers
912kviews
Serializing to JSON in jQuery [duplicate]
I need to serialize an object to JSON. I'm using jQuery. Is there a "standard" way to do this?
My specific situation: I have an array defined as shown below:
var countries = new Array();
countries[0]...
1143votes
36answers
1.1mviews
How to make a class JSON serializable
How to make a Python class serializable?
A simple class:
class FileItem:
def __init__(self, fname):
self.fname = fname
What should I do to be able to get output of:
>>> ...
1137votes
15answers
1.8mviews
How do I turn a C# object into a JSON string in .NET?
I have classes like these:
class MyDate
{
int year, month, day;
}
class Lad
{
string firstName;
string lastName;
MyDate dateOfBirth;
}
And I would like to turn a Lad object into a ...
1112votes
30answers
956kviews
Deserialize JSON into C# dynamic object?
Is there a way to deserialize JSON content into a C# dynamic type? It would be nice to skip creating a bunch of classes in order to use the DataContractJsonSerializer.
1105votes
39answers
1.9mviews
Converting an object to a string
How can I convert a JavaScript object into a string?
Example:
var o = {a:1, b:2}
console.log(o)
console.log('Item: ' + o)
Output:
Object { a=1, b=2} // very nice readable output :)
Item: [...
654votes
10answers
562kviews
How do you do a deep copy of an object in .NET? [duplicate]
I want a true deep copy. In Java, this was easy, but how do you do it in C#?
637votes
20answers
215kviews
Preferred method to store PHP arrays (json_encode vs serialize)
I need to store a multi-dimensional associative array of data in a flat file for caching purposes. I might occasionally come across the need to convert it to JSON for use in my web app but the vast ...
631votes
13answers
136kviews
What is the difference between Serialization and Marshaling?
I know that in terms of several distributed techniques (such as RPC), the term "Marshaling" is used but don't understand how it differs from Serialization. Aren't they both transforming ...
573votes
26answers
413kviews
JSON.NET Error Self referencing loop detected for type
I tried to serialize POCO class that was automatically generated from Entity Data Model .edmx and when I used
JsonConvert.SerializeObject
I got the following error:
Error Self referencing loop ...
516votes
17answers
754kviews
How to Deserialize XML document
How do I Deserialize this XML document:
<?xml version="1.0" encoding="utf-8"?>
<Cars>
<Car>
<StockNumber>1020</StockNumber>
<Make>Nissan</Make>
...
491votes
3answers
365kviews
How can I change property names when serializing with Json.net?
I have some data in a C# DataSet object. I can serialize it right now using a Json.net converter like this
DataSet data = new DataSet();
// do some work here to populate 'data'
string output = ...
441votes
16answers
353kviews
Gson: How to exclude specific fields from Serialization without annotations
I'm trying to learn Gson and I'm struggling with field exclusion. Here are my classes
public class Student {
private Long id;
private String firstName = "...