The encoding of objects and the objects reachable from them into a stream of bytes. The complementary reconstruction of the objects is called deserialization.
Questions tagged [object-serialization]
61 questions
424
votes
15 answers
What is object serialization?
What is meant by "object serialization"? Can you please explain it with some examples?

Warrior
- 39,156
- 44
- 139
- 214
105
votes
11 answers
Serializing PHP object to JSON
So I was wandering around php.net for information about serializing PHP objects to JSON, when I stumbled across the new JsonSerializable Interface. It's only PHP >= 5.4 though, and I'm running in a 5.3.x environment.
How is this sort of…

Dan Lugg
- 20,192
- 19
- 110
- 174
97
votes
3 answers
What is the difference between pickle and shelve?
I am learning about object serialization for the first time. I tried reading and 'googling' for differences in the modules pickle and shelve but I am not sure I understand it. When to use which one?
Pickle can turn every python object into stream…

zubinmehta
- 4,368
- 7
- 33
- 51
34
votes
3 answers
Java object Serialization and inheritance
Say you have these two classes, Foo and Bar where Bar extends Foo and implements Serializable
class Foo {
public String name;
public Foo() {
this.name = "Default";
}
public Foo(String name) {
this.name = name;
}
}
class Bar extends Foo…

Sleiman Jneidi
- 22,907
- 14
- 56
- 77
12
votes
4 answers
Storing a serialized object in MySql database
I have a big php object that I want to serialize and store in a MySql database. The table encoding is UTF-8 and the column to hold the serialized object encoding is also UTF-8.
The problem is the object holds a text string containing French…

Songo
- 5,618
- 8
- 58
- 96
8
votes
4 answers
Java Seralization and Deseralization
I have an object as follows:
public class Records implements java.io.Serializable{
private int cId;
private int pId;
private int vlaue;
private int tag;
public Records(int c, int p, int v, int t){
…

DotNet
- 697
- 2
- 7
- 23
7
votes
3 answers
How does object serialize/unserialize work?
I was reading about serialize/unserialize concepts of PHP. I was wondering how they are stored in the filesystem/db. I guess it is in the binary format. However, I wonder how entire class is stored? I understood that data in the data member can be…

dejjub-AIS
- 1,501
- 2
- 24
- 50
7
votes
1 answer
How to get object's value in Pug?
I'm using Node.js to render a page using Pug. My JavaScript code:
router.get('/', function(req, res, next) {
res.render("index",{
title:"首页",
user:{name:"luo",age:19}
});
});
My Pug code:
script.
window.user = #{user}
But the…

laoqiren
- 3,457
- 5
- 19
- 29
7
votes
3 answers
How can I store an object on my hard drive?
I'm working on a project that uses a couple maps that can have over 100,000 keys. Currently I'm creating the maps at each runtime using an abbreviated form of the data to save time so that the maps only have around 1,000 keys. But I would like to…

Bradley Oesch
- 763
- 10
- 22
6
votes
1 answer
Delphi client server array sending
I need to send a dynamic array of objects from server to clients. An example as array which cointains objects of class Figure with information about its coordiantes, color etc.
I was trying to use something like this to send data:
for i := 0 to…

DanilGholtsman
- 2,354
- 4
- 38
- 69
5
votes
1 answer
php how to serialize array of objects?
I have small class called 'Call' and I need to store these calls into a flat file. I've made another class called 'CallStorage' which contains an array where I put these calls into.
My problem is that I would like to store this array to disk so I…

hequ
- 761
- 6
- 14
4
votes
1 answer
How to keep PHP object alive (or in memory) between AJAX calls
I have the following class definition:
class DatasegmentationController
{
public function indexAction()
{
$options['permissions'] = array(
'canDelete' => false,
'canEdit' => false
);
…

ReynierPM
- 17,594
- 53
- 193
- 363
4
votes
4 answers
Serializable a object properties too
When I have Serializable in a class, do I need to add Serializable to all my objects within the class?
For example,
public class User implements Serializable{
private List role;
private Task task;
}
Do I need to add Serializable to Role and…

nimo23
- 5,170
- 10
- 46
- 75
3
votes
1 answer
How to do a form POST to an MVC 3 application and obtain the deserialized class?
I have the following form:

pilavdzice
- 958
- 8
- 27
3
votes
3 answers
Object Serialization
Assume object A has 6 fields, now the object A is serialized, after some time the 3 more fields are added and the object is deserialized.
Adding of the new fields will create any exception when deserializing.
How to have a backward compatibility …

Raghav55
- 3,055
- 6
- 28
- 38