<s>
In	O
computing	O
,	O
serialization	B-Application
(	O
or	O
serialisation	B-Application
)	O
is	O
the	O
process	O
of	O
translating	O
a	O
data	B-General_Concept
structure	I-General_Concept
or	O
object	O
state	O
into	O
a	O
format	O
that	O
can	O
be	O
stored	O
(	O
e.g.	O
</s>
<s>
files	B-Operating_System
in	O
secondary	O
storage	O
devices	O
,	O
data	B-General_Concept
buffers	I-General_Concept
in	O
primary	O
storage	O
devices	O
)	O
or	O
transmitted	O
(	O
e.g.	O
</s>
<s>
data	B-General_Concept
streams	I-General_Concept
over	O
computer	B-Architecture
networks	I-Architecture
)	O
and	O
reconstructed	O
later	O
(	O
possibly	O
in	O
a	O
different	O
computer	O
environment	O
)	O
.	O
</s>
<s>
When	O
the	O
resulting	O
series	O
of	O
bits	O
is	O
reread	O
according	O
to	O
the	O
serialization	B-Application
format	O
,	O
it	O
can	O
be	O
used	O
to	O
create	O
a	O
semantically	O
identical	O
clone	O
of	O
the	O
original	O
object	O
.	O
</s>
<s>
Serialization	B-Application
of	O
object-oriented	B-Language
objects	O
does	O
not	O
include	O
any	O
of	O
their	O
associated	O
methods	B-Language
with	O
which	O
they	O
were	O
previously	O
linked	O
.	O
</s>
<s>
This	O
process	O
of	O
serializing	B-Application
an	O
object	O
is	O
also	O
called	O
marshalling	B-Application
an	O
object	O
in	O
some	O
situations	O
.	O
</s>
<s>
The	O
opposite	O
operation	O
,	O
extracting	O
a	O
data	B-General_Concept
structure	I-General_Concept
from	O
a	O
series	O
of	O
bytes	O
,	O
is	O
deserialization	B-Application
,	O
(	O
also	O
called	O
unserialization	O
or	O
unmarshalling	B-Application
)	O
.	O
</s>
<s>
Methods	B-Language
of	O
:	O
</s>
<s>
transferring	O
data	O
through	O
the	O
wires	O
(	O
messaging	B-Protocol
)	O
.	O
</s>
<s>
storing	O
data	O
(	O
in	O
databases	O
,	O
on	O
hard	B-Device
disk	I-Device
drives	I-Device
)	O
.	O
</s>
<s>
remote	B-Operating_System
procedure	I-Operating_System
calls	I-Operating_System
,	O
e.g.	O
,	O
as	O
in	O
SOAP	B-Application
.	O
</s>
<s>
distributing	O
objects	O
,	O
especially	O
in	O
component-based	B-Architecture
software	I-Architecture
engineering	I-Architecture
such	O
as	O
COM	B-Application
,	O
CORBA	B-Architecture
,	O
etc	O
.	O
</s>
<s>
For	O
example	O
,	O
for	O
maximal	O
use	O
of	O
distribution	O
,	O
a	O
computer	O
running	O
on	O
a	O
different	O
hardware	O
architecture	O
should	O
be	O
able	O
to	O
reliably	O
reconstruct	O
a	O
serialized	O
data	B-General_Concept
stream	I-General_Concept
,	O
regardless	O
of	O
endianness	O
.	O
</s>
<s>
This	O
means	O
that	O
the	O
simpler	O
and	O
faster	O
procedure	O
of	O
directly	O
copying	O
the	O
memory	O
layout	O
of	O
the	O
data	B-General_Concept
structure	I-General_Concept
cannot	O
work	O
reliably	O
for	O
all	O
architectures	O
.	O
</s>
<s>
Serializing	B-Application
the	O
data	B-General_Concept
structure	I-General_Concept
in	O
an	O
architecture-independent	O
format	O
means	O
preventing	O
the	O
problems	O
of	O
byte	O
ordering	O
,	O
memory	O
layout	O
,	O
or	O
simply	O
different	O
ways	O
of	O
representing	O
data	B-General_Concept
structures	I-General_Concept
in	O
different	O
programming	O
languages	O
.	O
</s>
<s>
Inherent	O
to	O
any	O
serialization	B-Application
scheme	O
is	O
that	O
,	O
because	O
the	O
encoding	O
of	O
the	O
data	O
is	O
by	O
definition	O
serial	O
,	O
extracting	O
one	O
part	O
of	O
the	O
serialized	O
data	B-General_Concept
structure	I-General_Concept
requires	O
that	O
the	O
entire	O
object	O
be	O
read	O
from	O
start	O
to	O
end	O
,	O
and	O
reconstructed	O
.	O
</s>
<s>
In	O
many	O
applications	O
,	O
this	O
linearity	O
is	O
an	O
asset	O
,	O
because	O
it	O
enables	O
simple	O
,	O
common	O
I/O	O
interfaces	B-Application
to	O
be	O
utilized	O
to	O
hold	O
and	O
pass	O
on	O
the	O
state	O
of	O
an	O
object	O
.	O
</s>
<s>
To	O
deal	O
with	O
this	O
,	O
the	O
serialization	B-Application
process	O
includes	O
a	O
step	O
called	O
unswizzling	B-General_Concept
or	O
pointer	B-General_Concept
unswizzling	I-General_Concept
,	O
where	O
direct	O
pointer	O
references	O
are	O
converted	O
to	O
references	O
based	O
on	O
name	O
or	O
position	O
.	O
</s>
<s>
The	O
deserialization	B-Application
process	O
includes	O
an	O
inverse	O
step	O
called	O
pointer	B-General_Concept
swizzling	I-General_Concept
.	O
</s>
<s>
Since	O
both	O
serializing	B-Application
and	O
deserializing	O
can	O
be	O
driven	O
from	O
common	O
code	O
(	O
for	O
example	O
,	O
the	O
Serialize	B-Application
function	O
in	O
Microsoft	B-Language
Foundation	I-Language
Classes	I-Language
)	O
,	O
it	O
is	O
possible	O
for	O
the	O
common	O
code	O
to	O
do	O
both	O
at	O
the	O
same	O
time	O
,	O
and	O
thus	O
,	O
1	O
)	O
detect	O
differences	O
between	O
the	O
objects	O
being	O
serialized	O
and	O
their	O
prior	O
copies	O
,	O
and	O
2	O
)	O
provide	O
the	O
input	O
for	O
the	O
next	O
such	O
detection	O
.	O
</s>
<s>
This	O
is	O
useful	O
in	O
the	O
programming	O
of	O
user	O
interfaces	B-Application
whose	O
contents	O
are	O
time-varying	O
—	O
graphical	O
objects	O
can	O
be	O
created	O
,	O
removed	O
,	O
altered	O
,	O
or	O
made	O
to	O
handle	O
input	O
events	O
without	O
necessarily	O
having	O
to	O
write	O
separate	O
code	O
to	O
do	O
those	O
things	O
.	O
</s>
<s>
Serialization	B-Application
breaks	O
the	O
opacity	O
of	O
an	O
abstract	O
data	O
type	O
by	O
potentially	O
exposing	O
private	O
implementation	O
details	O
.	O
</s>
<s>
Trivial	O
implementations	O
which	O
serialize	B-Application
all	O
data	O
members	O
may	O
violate	O
encapsulation	B-Application
.	O
</s>
<s>
To	O
discourage	O
competitors	O
from	O
making	O
compatible	O
products	O
,	O
publishers	O
of	O
proprietary	B-Application
software	I-Application
often	O
keep	O
the	O
details	O
of	O
their	O
programs	O
 '	O
serialization	B-Application
formats	O
a	O
trade	O
secret	O
.	O
</s>
<s>
Yet	O
,	O
interoperability	O
requires	O
that	O
applications	O
be	O
able	O
to	O
understand	O
each	O
other	O
's	O
serialization	B-Application
formats	O
.	O
</s>
<s>
Therefore	O
,	O
remote	B-Operating_System
method	I-Operating_System
call	I-Operating_System
architectures	O
such	O
as	O
CORBA	B-Architecture
define	O
their	O
serialization	B-Application
formats	O
in	O
detail	O
.	O
</s>
<s>
Many	O
institutions	O
,	O
such	O
as	O
archives	O
and	O
libraries	O
,	O
attempt	O
to	O
future	O
proof	O
their	O
backup	B-Protocol
archives	O
—	O
in	O
particular	O
,	O
database	O
dumps	B-Application
—	O
by	O
storing	O
them	O
in	O
some	O
relatively	O
human-readable	B-General_Concept
serialized	O
format	O
.	O
</s>
<s>
The	O
Xerox	B-Protocol
Network	I-Protocol
Systems	I-Protocol
Courier	O
technology	O
in	O
the	O
early	O
1980s	O
influenced	O
the	O
first	O
widely	O
adopted	O
standard	O
.	O
</s>
<s>
Sun	O
Microsystems	O
published	O
the	O
External	B-Protocol
Data	I-Protocol
Representation	I-Protocol
(	O
XDR	O
)	O
in	O
1987	O
.	O
</s>
<s>
In	O
the	O
late	O
1990s	O
,	O
a	O
push	O
to	O
provide	O
an	O
alternative	O
to	O
the	O
standard	O
serialization	B-Application
protocols	O
started	O
:	O
XML	B-Protocol
,	O
an	O
SGML	B-Language
subset	O
,	O
was	O
used	O
to	O
produce	O
a	O
human-readable	B-General_Concept
text-based	O
encoding	O
.	O
</s>
<s>
In	O
the	O
2000s	O
,	O
XML	B-Protocol
was	O
often	O
used	O
for	O
asynchronous	O
transfer	O
of	O
structured	O
data	O
between	O
client	O
and	O
server	O
in	O
Ajax	B-General_Concept
web	O
applications	O
.	O
</s>
<s>
XML	B-Protocol
is	O
an	O
open	O
format	O
,	O
and	O
standardized	O
as	O
a	O
.	O
</s>
<s>
JSON	B-General_Concept
is	O
a	O
lightweight	O
plain-text	O
alternative	O
to	O
XML	B-Protocol
,	O
and	O
is	O
also	O
commonly	O
used	O
for	O
client-server	O
communication	O
in	O
web	O
applications	O
.	O
</s>
<s>
JSON	B-General_Concept
is	O
based	O
on	O
JavaScript	B-Language
syntax	I-Language
,	O
but	O
is	O
independent	O
of	O
JavaScript	B-Language
and	O
supported	O
in	O
many	O
other	O
programming	O
languages	O
.	O
</s>
<s>
JSON	B-General_Concept
is	O
an	O
open	O
format	O
,	O
standardized	O
as	O
(	O
)	O
,	O
,	O
and	O
.	O
</s>
<s>
YAML	B-Protocol
is	O
a	O
strict	O
superset	O
of	O
JSON	B-General_Concept
and	O
includes	O
additional	O
features	O
such	O
as	O
a	O
data	O
type	O
tags	O
,	O
support	O
for	O
cyclic	O
data	B-General_Concept
structures	I-General_Concept
,	O
indentation-sensitive	O
syntax	O
,	O
and	O
multiple	O
forms	O
of	O
scalar	O
data	O
quoting	O
.	O
</s>
<s>
YAML	B-Protocol
is	O
an	O
open	O
format	O
.	O
</s>
<s>
Property	B-Application
lists	I-Application
are	O
used	O
for	O
serialization	B-Application
by	O
NeXTSTEP	B-Application
,	O
GNUstep	B-Application
,	O
macOS	B-Application
,	O
and	O
iOS	B-Application
frameworks	B-Architecture
.	O
</s>
<s>
Property	B-Application
list	I-Application
,	O
or	O
p-list	B-Application
for	O
short	O
,	O
does	O
n't	O
refer	O
to	O
a	O
single	O
serialization	B-Application
format	O
but	O
instead	O
several	O
different	O
variants	O
,	O
some	O
human-readable	B-General_Concept
and	O
one	O
binary	O
.	O
</s>
<s>
For	O
large	O
volume	O
scientific	O
datasets	O
,	O
such	O
as	O
satellite	O
data	O
and	O
output	O
of	O
numerical	O
climate	O
,	O
weather	O
,	O
or	O
ocean	O
models	O
,	O
specific	O
binary	O
serialization	B-Application
standards	O
have	O
been	O
developed	O
,	O
e.g.	O
</s>
<s>
HDF	B-Application
,	O
netCDF	B-Application
and	O
the	O
older	O
GRIB	B-Application
.	O
</s>
<s>
Several	O
object-oriented	B-Language
programming	I-Language
languages	I-Language
directly	O
support	O
object	B-Application
serialization	I-Application
(	O
or	O
object	B-Application
archival	I-Application
)	O
,	O
either	O
by	O
syntactic	O
sugar	O
elements	O
or	O
providing	O
a	O
standard	O
interface	B-Language
for	O
doing	O
so	O
.	O
</s>
<s>
The	O
languages	O
which	O
do	O
so	O
include	O
Ruby	B-Language
,	O
Smalltalk	B-Application
,	O
Python	B-Language
,	O
PHP	B-Application
,	O
Objective-C	B-Language
,	O
Delphi	B-Language
,	O
Java	B-Language
,	O
and	O
the	O
.NET	B-Application
family	O
of	O
languages	O
.	O
</s>
<s>
There	O
are	O
also	O
libraries	O
available	O
that	O
add	O
serialization	B-Application
support	O
to	O
languages	O
that	O
lack	O
native	O
support	O
for	O
it	O
.	O
</s>
<s>
C	B-Language
and	O
C++	B-Language
C	B-Language
and	O
C++	B-Language
do	O
not	O
provide	O
serialization	B-Application
as	O
any	O
sort	O
of	O
high-level	O
construct	O
,	O
but	O
both	O
languages	O
support	O
writing	O
any	O
of	O
the	O
built-in	O
data	B-Language
types	I-Language
,	O
as	O
well	O
as	O
plain	B-Language
old	I-Language
data	I-Language
structs	B-Language
,	O
as	O
binary	O
data	O
.	O
</s>
<s>
As	O
such	O
,	O
it	O
is	O
usually	O
trivial	O
to	O
write	O
custom	O
serialization	B-Application
functions	O
.	O
</s>
<s>
Moreover	O
,	O
compiler-based	O
solutions	O
,	O
such	O
as	O
the	O
ODB	O
ORM	B-General_Concept
system	O
for	O
C++	B-Language
and	O
the	O
gSOAP	O
toolkit	O
for	O
C	B-Language
and	O
C++	B-Language
,	O
are	O
capable	O
of	O
automatically	O
producing	O
serialization	B-Application
code	O
with	O
few	O
or	O
no	O
modifications	O
to	O
class	O
declarations	O
.	O
</s>
<s>
Other	O
popular	O
serialization	B-Application
frameworks	B-Architecture
are	O
Boost.Serialization	O
from	O
the	O
Boost	B-Language
Framework	I-Language
,	O
the	O
S11n	O
framework	O
,	O
and	O
Cereal	O
.	O
</s>
<s>
MFC	B-Language
framework	I-Language
(	O
Microsoft	O
)	O
also	O
provides	O
serialization	B-Application
methodology	O
as	O
part	O
of	O
its	O
Document-View	O
architecture	O
.	O
</s>
<s>
CFML	B-Language
CFML	B-Language
allows	O
data	B-General_Concept
structures	I-General_Concept
to	O
be	O
serialized	O
to	O
WDDX	B-Protocol
with	O
the	O
<cfwddx>	O
tag	O
and	O
to	O
JSON	B-General_Concept
with	O
the	O
function	O
.	O
</s>
<s>
Delphi	B-Language
Delphi	B-Language
provides	O
a	O
built-in	O
mechanism	O
for	O
serialization	B-Application
of	O
components	O
(	O
also	O
called	O
persistent	O
objects	O
)	O
,	O
which	O
is	O
fully	O
integrated	O
with	O
its	O
IDE	B-Application
.	O
</s>
<s>
Go	B-Application
Go	B-Application
natively	O
supports	O
unmarshalling/marshalling	O
of	O
JSON	B-General_Concept
and	O
XML	B-Protocol
data	O
.	O
</s>
<s>
There	O
are	O
also	O
third-party	O
modules	O
that	O
support	O
YAML	B-Protocol
and	O
Protocol	B-Protocol
Buffers	I-Protocol
.	O
</s>
<s>
Go	B-Application
also	O
supports	O
Gobs	O
.	O
</s>
<s>
Haskell	O
In	O
Haskell	O
,	O
serialization	B-Application
is	O
supported	O
for	O
types	O
that	O
are	O
members	O
of	O
the	O
Read	O
and	O
Show	O
type	O
classes	O
.	O
</s>
<s>
For	O
more	O
efficient	O
serialization	B-Application
,	O
there	O
are	O
haskell	O
libraries	O
that	O
allow	O
high-speed	O
serialization	B-Application
in	O
binary	O
format	O
,	O
e.g.	O
</s>
<s>
Java	B-Language
Java	B-Language
provides	O
automatic	O
serialization	B-Application
which	O
requires	O
that	O
the	O
object	O
be	O
marked	B-Language
by	O
implementing	O
the	O
interface	B-Language
.	O
</s>
<s>
Implementing	O
the	O
interface	B-Language
marks	O
the	O
class	O
as	O
"	O
okay	O
to	O
serialize	B-Application
"	O
,	O
and	O
Java	B-Language
then	O
handles	O
serialization	B-Application
internally	O
.	O
</s>
<s>
There	O
are	O
no	O
serialization	B-Application
methods	B-Language
defined	O
on	O
the	O
Serializable	O
interface	B-Language
,	O
but	O
a	O
serializable	O
class	O
can	O
optionally	O
define	O
methods	B-Language
with	O
certain	O
special	O
names	O
and	O
signatures	O
that	O
if	O
defined	O
,	O
will	O
be	O
called	O
as	O
part	O
of	O
the	O
serialization/deserialization	O
process	O
.	O
</s>
<s>
The	O
language	O
also	O
allows	O
the	O
developer	O
to	O
override	O
the	O
serialization	B-Application
process	O
more	O
thoroughly	O
by	O
implementing	O
another	O
interface	B-Language
,	O
the	O
interface	B-Language
,	O
which	O
includes	O
two	O
special	O
methods	B-Language
that	O
are	O
used	O
to	O
save	O
and	O
restore	O
the	O
object	O
's	O
state	O
.	O
</s>
<s>
There	O
are	O
three	O
primary	O
reasons	O
why	O
objects	O
are	O
not	O
serializable	O
by	O
default	O
and	O
must	O
implement	O
the	O
Serializable	O
interface	B-Language
to	O
access	O
Java	B-Language
's	O
serialization	B-Application
mechanism.Firstly	O
,	O
not	O
all	O
objects	O
capture	O
useful	O
semantics	O
in	O
a	O
serialized	O
state	O
.	O
</s>
<s>
For	O
example	O
,	O
a	O
object	O
is	O
tied	O
to	O
the	O
state	O
of	O
the	O
current	O
JVM	B-Language
.	O
</s>
<s>
Therefore	O
,	O
making	O
a	O
class	O
serializable	O
needs	O
to	O
be	O
a	O
deliberate	O
design	O
decision	O
and	O
not	O
a	O
default	O
condition.Lastly	O
,	O
serialization	B-Application
allows	O
access	O
to	O
non-transient	O
private	O
members	O
of	O
a	O
class	O
that	O
are	O
not	O
otherwise	O
accessible	O
.	O
</s>
<s>
Primitives	O
as	O
well	O
as	O
non-transient	O
,	O
non-static	O
referenced	O
objects	O
are	O
encoded	O
into	O
the	O
stream	O
.	O
</s>
<s>
Each	O
object	O
that	O
is	O
referenced	O
by	O
the	O
serialized	B-Application
object	I-Application
via	O
a	O
field	O
that	O
is	O
not	O
marked	B-Language
as	O
transient	B-Device
must	O
also	O
be	O
serialized	O
;	O
and	O
if	O
any	O
object	O
in	O
the	O
complete	O
graph	O
of	O
non-transient	O
object	O
references	O
is	O
not	O
serializable	O
,	O
then	O
serialization	B-Application
will	O
fail	O
.	O
</s>
<s>
The	O
developer	O
can	O
influence	O
this	O
behavior	O
by	O
marking	O
objects	O
as	O
transient	B-Device
,	O
or	O
by	O
redefining	O
the	O
serialization	B-Application
for	O
an	O
object	O
so	O
that	O
some	O
portion	O
of	O
the	O
reference	O
graph	O
is	O
truncated	O
and	O
not	O
serialized	O
.	O
</s>
<s>
Java	B-Language
does	O
not	O
use	O
constructor	O
to	O
serialize	B-Application
objects	O
.	O
</s>
<s>
It	O
is	O
possible	O
to	O
serialize	B-Application
Java	B-Language
objects	O
through	O
JDBC	B-Language
and	O
store	O
them	O
into	O
a	O
database	O
.	O
</s>
<s>
While	O
Swing	B-Language
components	O
do	O
implement	O
the	O
Serializable	O
interface	B-Language
,	O
they	O
are	O
not	O
guaranteed	O
to	O
be	O
portable	O
between	O
different	O
versions	O
of	O
the	O
Java	B-Language
Virtual	I-Language
Machine	I-Language
.	O
</s>
<s>
As	O
such	O
,	O
a	O
Swing	B-Language
component	O
,	O
or	O
any	O
component	O
which	O
inherits	O
it	O
,	O
may	O
be	O
serialized	O
to	O
a	O
byte	O
stream	O
,	O
but	O
it	O
is	O
not	O
guaranteed	O
that	O
this	O
will	O
be	O
re-constitutable	O
on	O
another	O
machine	O
.	O
</s>
<s>
JavaScript	B-Language
Since	O
ECMAScript	O
5.1	O
,	O
JavaScript	B-Language
has	O
included	O
the	O
built-in	O
JSON	B-General_Concept
object	O
and	O
its	O
methods	B-Language
JSON.parse( )	O
and	O
JSON.stringify( )	O
.	O
</s>
<s>
Although	O
JSON	B-General_Concept
is	O
originally	O
based	O
on	O
a	O
subset	O
of	O
JavaScript	B-Language
,	O
there	O
are	O
boundary	O
cases	O
where	O
JSON	B-General_Concept
is	O
not	O
valid	O
JavaScript	B-Language
.	O
</s>
<s>
Specifically	O
,	O
JSON	B-General_Concept
allows	O
the	O
Unicode	O
line	O
terminators	O
and	O
to	O
appear	O
unescaped	O
in	O
quoted	O
strings	O
,	O
while	O
ECMAScript	O
2018	O
and	O
older	O
does	O
not	O
.	O
</s>
<s>
See	O
the	O
main	O
article	O
on	O
JSON	B-General_Concept
.	O
</s>
<s>
Julia	B-Application
Julia	B-Application
implements	B-Language
serialization	B-Application
through	O
the	O
serialize( )	O
/	O
deserialize( )	O
modules	O
,	O
intended	O
to	O
work	O
within	O
the	O
same	O
version	O
of	O
Julia	B-Application
,	O
and/or	O
instance	O
of	O
the	O
same	O
system	O
image	O
.	O
</s>
<s>
The	O
HDF5.jl	O
package	O
offers	O
a	O
more	O
stable	O
alternative	O
,	O
using	O
a	O
documented	O
format	O
and	O
common	O
library	O
with	O
wrappers	O
for	O
different	O
languages	O
,	O
while	O
the	O
default	O
serialization	B-Application
format	O
is	O
suggested	O
to	O
have	O
been	O
designed	O
rather	O
with	O
maximal	O
performance	O
for	O
network	O
communication	O
in	O
mind	O
.	O
</s>
<s>
Lisp	B-Language
Generally	O
a	O
Lisp	B-Language
data	B-General_Concept
structure	I-General_Concept
can	O
be	O
serialized	O
with	O
the	O
functions	O
"	O
read	O
"	O
and	O
"	O
print	O
"	O
.	O
</s>
<s>
These	O
two	O
parts	O
of	O
the	O
Lisp	B-Language
implementation	O
are	O
called	O
the	O
Printer	O
and	O
the	O
Reader	O
.	O
</s>
<s>
The	O
output	O
of	O
"	O
print	O
"	O
is	O
human	B-General_Concept
readable	I-General_Concept
;	O
it	O
uses	O
lists	O
demarked	O
by	O
parentheses	O
,	O
for	O
example	O
:	O
.	O
</s>
<s>
In	O
many	O
types	O
of	O
Lisp	B-Language
,	O
including	O
Common	B-Language
Lisp	I-Language
,	O
the	O
printer	O
cannot	O
represent	O
every	O
type	O
of	O
data	O
because	O
it	O
is	O
not	O
clear	O
how	O
to	O
do	O
so	O
.	O
</s>
<s>
In	O
Common	B-Language
Lisp	I-Language
for	O
example	O
the	O
printer	O
cannot	O
print	O
CLOS	O
objects	O
.	O
</s>
<s>
This	O
is	O
somewhat	O
similar	O
to	O
the	O
method	O
used	O
in	O
Ruby	B-Language
.	O
</s>
<s>
Lisp	B-Language
code	O
itself	O
is	O
written	O
in	O
the	O
syntax	O
of	O
the	O
reader	O
,	O
called	O
read	O
syntax	O
.	O
</s>
<s>
Most	O
languages	O
use	O
separate	O
and	O
different	O
parsers	O
to	O
deal	O
with	O
code	O
and	O
data	O
,	O
Lisp	B-Language
only	O
uses	O
one	O
.	O
</s>
<s>
A	O
file	O
containing	O
lisp	B-Language
code	O
may	O
be	O
read	O
into	O
memory	O
as	O
a	O
data	B-General_Concept
structure	I-General_Concept
,	O
transformed	O
by	O
another	O
program	O
,	O
then	O
possibly	O
executed	O
or	O
written	O
out	O
,	O
such	O
as	O
in	O
a	O
read	B-Application
–	I-Application
eval	I-Application
–	I-Application
print	I-Application
loop	I-Application
.	O
</s>
<s>
.NET	B-Application
Framework	I-Application
.NET	B-Application
Framework	I-Application
has	O
several	O
serializers	O
designed	O
by	O
Microsoft	O
.	O
</s>
<s>
OCaml	B-Language
OCaml	B-Language
's	O
standard	O
library	O
provides	O
marshalling	B-Application
through	O
the	O
Marshal	O
module	O
and	O
the	O
Pervasives	O
functions	O
output_value	O
and	O
input_value	O
.	O
</s>
<s>
While	O
OCaml	B-Language
programming	O
is	O
statically	O
type-checked	O
,	O
uses	O
of	O
the	O
Marshal	O
module	O
may	O
break	O
type	O
guarantees	O
,	O
as	O
there	O
is	O
no	O
way	O
to	O
check	O
whether	O
an	O
unmarshalled	O
stream	O
represents	O
objects	O
of	O
the	O
expected	O
type	O
.	O
</s>
<s>
In	O
OCaml	B-Language
it	O
is	O
difficult	O
to	O
marshal	O
a	O
function	O
or	O
a	O
data	B-General_Concept
structure	I-General_Concept
which	O
contains	O
a	O
function	O
(	O
e.g.	O
</s>
<s>
The	O
standard	O
marshalling	B-Application
functions	O
can	O
preserve	O
sharing	O
and	O
handle	O
cyclic	O
data	O
,	O
which	O
can	O
be	O
configured	O
by	O
a	O
flag	O
.	O
</s>
<s>
Perl	B-Language
Several	O
Perl	B-Language
modules	O
available	O
from	O
CPAN	B-Language
provide	O
serialization	B-Application
mechanisms	O
,	O
including	O
Storable	O
,	O
JSON::XS	O
and	O
FreezeThaw	O
.	O
</s>
<s>
Storable	O
includes	O
functions	O
to	O
serialize	B-Application
and	O
deserialize	B-Application
Perl	B-Language
data	B-General_Concept
structures	I-General_Concept
to	O
and	O
from	O
files	B-Operating_System
or	O
Perl	B-Language
scalars	O
.	O
</s>
<s>
In	O
addition	O
to	O
serializing	B-Application
directly	O
to	O
files	B-Operating_System
,	O
Storable	O
includes	O
the	O
freeze	O
function	O
to	O
return	O
a	O
serialized	O
copy	O
of	O
the	O
data	O
packed	O
into	O
a	O
scalar	O
,	O
and	O
thaw	O
to	O
deserialize	B-Application
such	O
a	O
scalar	O
.	O
</s>
<s>
This	O
is	O
useful	O
for	O
sending	O
a	O
complex	O
data	B-General_Concept
structure	I-General_Concept
over	O
a	O
network	O
socket	O
or	O
storing	O
it	O
in	O
a	O
database	O
.	O
</s>
<s>
When	O
serializing	B-Application
structures	O
with	O
Storable	O
,	O
there	O
are	O
network	O
safe	O
functions	O
that	O
always	O
store	O
their	O
data	O
in	O
a	O
format	O
that	O
is	O
readable	O
on	O
any	O
computer	O
at	O
a	O
small	O
cost	O
of	O
speed	O
.	O
</s>
<s>
There	O
are	O
no	O
"	O
n	O
"	O
functions	O
for	O
deserializing	O
these	O
structures	O
—	O
the	O
regular	O
thaw	O
and	O
retrieve	O
deserialize	B-Application
structures	O
serialized	O
with	O
the	O
"	O
n	O
"	O
functions	O
and	O
their	O
machine-specific	O
equivalents	O
.	O
</s>
<s>
PHP	B-Application
PHP	B-Application
originally	O
implemented	O
serialization	B-Application
through	O
the	O
built-in	O
serialize( )	O
and	O
unserialize( )	O
functions	O
.	O
</s>
<s>
PHP	B-Application
can	O
serialize	B-Application
any	O
of	O
its	O
data	B-Language
types	I-Language
except	O
resources	O
(	O
file	O
pointers	O
,	O
sockets	O
,	O
etc	O
.	O
)	O
.	O
</s>
<s>
For	O
objects	O
,	O
there	O
are	O
two	O
"	O
magic	O
methods	B-Language
"	O
that	O
can	O
be	O
implemented	O
within	O
a	O
class	O
—	O
__sleep( )	O
and	O
__wakeup( )	O
—	O
that	O
are	O
called	O
from	O
within	O
serialize( )	O
and	O
unserialize( )	O
,	O
respectively	O
,	O
that	O
can	O
clean	O
up	O
and	O
restore	O
an	O
object	O
.	O
</s>
<s>
For	O
example	O
,	O
it	O
may	O
be	O
desirable	O
to	O
close	O
a	O
database	O
connection	O
on	O
serialization	B-Application
and	O
restore	O
the	O
connection	O
on	O
deserialization	B-Application
;	O
this	O
functionality	O
would	O
be	O
handled	O
in	O
these	O
two	O
magic	O
methods	B-Language
.	O
</s>
<s>
Since	O
PHP	B-Application
5.1	O
,	O
there	O
is	O
an	O
object-oriented	B-Language
serialization	B-Application
mechanism	O
for	O
objects	O
,	O
the	O
Serializable	O
interface	B-Language
.	O
</s>
<s>
Prolog	B-Language
Prolog	B-Language
's	O
term	O
structure	O
,	O
which	O
is	O
the	O
only	O
data	B-General_Concept
structure	I-General_Concept
of	O
the	O
language	O
,	O
can	O
be	O
serialized	O
out	O
through	O
the	O
built-in	O
predicate	O
write_term/3	O
and	O
serialized-in	O
through	O
the	O
built-in	O
predicates	O
read/1	O
and	O
read_term/2	O
.	O
</s>
<s>
The	O
predicate	O
write_term/3	O
is	O
standardized	O
in	O
the	O
ISO	O
Specification	O
for	O
Prolog	B-Language
(	O
ISO/IEC	B-Language
13211-1	I-Language
)	O
on	O
pages	O
59	O
ff	O
.	O
</s>
<s>
SWI-Prolog	O
'	O
s	O
dictionaries	O
)	O
may	O
use	O
non-standard	O
term	O
structures	O
,	O
so	O
interoperability	O
may	O
break	O
in	O
edge	O
cases	O
.	O
</s>
<s>
As	O
examples	O
,	O
see	O
the	O
corresponding	O
manual	O
pages	O
for	O
SWI-Prolog	O
,	O
SICStus	B-Language
Prolog	I-Language
,	O
GNU	O
Prolog	B-Language
.	O
</s>
<s>
Whether	O
and	O
how	O
serialized	O
terms	O
received	O
over	O
the	O
network	O
are	O
checked	O
against	O
a	O
specification	O
(	O
after	O
deserialization	B-Application
from	O
the	O
character	O
stream	O
has	O
happened	O
)	O
is	O
left	O
to	O
the	O
implementer	O
.	O
</s>
<s>
Prolog	B-Language
's	O
built-in	O
Definite	O
Clause	O
Grammars	O
can	O
be	O
applied	O
at	O
that	O
stage	O
.	O
</s>
<s>
Python	B-Language
The	O
core	O
general	O
serialization	B-Application
mechanism	O
is	O
the	O
pickle	O
standard	O
library	O
module	O
,	O
alluding	O
to	O
the	O
database	O
systems	O
term	O
pickling	O
to	O
describe	O
data	B-Application
serialization	I-Application
(	O
unpickling	O
for	O
deserializing	O
)	O
.	O
</s>
<s>
Pickle	O
uses	O
a	O
simple	O
stack-based	O
virtual	B-Architecture
machine	I-Architecture
that	O
records	O
the	O
instructions	O
used	O
to	O
reconstruct	O
the	O
object	O
.	O
</s>
<s>
It	O
is	O
a	O
cross-version	O
but	O
unsafe	O
(	O
not	O
secure	O
against	O
erroneous	O
or	O
malicious	O
data	O
)	O
serialization	B-Application
format	O
.	O
</s>
<s>
The	O
standard	O
library	O
also	O
includes	O
modules	O
serializing	B-Application
to	O
standard	O
data	O
formats	O
:	O
json	B-General_Concept
(	O
with	O
built-in	O
support	O
for	O
basic	O
scalar	O
and	O
collection	O
types	O
and	O
able	O
to	O
support	O
arbitrary	O
types	O
via	O
)	O
.	O
</s>
<s>
plistlib	O
(	O
with	O
support	O
for	O
both	O
binary	O
and	O
XML	B-Protocol
property	B-Application
list	I-Application
formats	O
)	O
.	O
</s>
<s>
xdrlib	O
(	O
with	O
support	O
for	O
the	O
External	B-Protocol
Data	I-Protocol
Representation	I-Protocol
(	O
XDR	O
)	O
standard	O
as	O
described	O
in	O
RFC	O
1014	O
)	O
.	O
</s>
<s>
Finally	O
,	O
it	O
is	O
recommended	O
that	O
an	O
object	O
's	O
__repr__	O
be	O
evaluable	O
in	O
the	O
right	O
environment	O
,	O
making	O
it	O
a	O
rough	O
match	O
for	O
Common	B-Language
Lisp	I-Language
's	O
print-object	O
.	O
</s>
<s>
Not	O
all	O
object	O
types	O
can	O
be	O
pickled	O
automatically	O
,	O
especially	O
ones	O
that	O
hold	O
operating	B-General_Concept
system	I-General_Concept
resources	O
like	O
file	B-Application
handles	I-Application
,	O
but	O
users	O
can	O
register	O
custom	O
"	O
reduction	O
"	O
and	O
construction	O
functions	O
to	O
support	O
the	O
pickling	O
and	O
unpickling	O
of	O
arbitrary	O
types	O
.	O
</s>
<s>
Pickle	O
was	O
originally	O
implemented	O
as	O
the	O
pure	O
Python	B-Language
pickle	O
module	O
,	O
but	O
,	O
in	O
versions	O
of	O
Python	B-Language
prior	O
to	O
3.0	O
,	O
the	O
cPickle	O
module	O
(	O
also	O
a	O
built-in	O
)	O
offers	O
improved	O
performance	O
(	O
up	O
to	O
1000	O
times	O
faster	O
)	O
.	O
</s>
<s>
In	O
Python	B-Language
3	O
,	O
users	O
should	O
always	O
import	O
the	O
standard	O
version	O
,	O
which	O
attempts	O
to	O
import	O
the	O
accelerated	O
version	O
and	O
falls	O
back	O
to	O
the	O
pure	O
Python	B-Language
version	O
.	O
</s>
<s>
R	B-Language
R	B-Language
has	O
the	O
function	O
dput	O
which	O
writes	O
an	O
ASCII	O
text	O
representation	O
of	O
an	O
R	B-Language
object	O
to	O
a	O
file	O
or	O
connection	O
.	O
</s>
<s>
More	O
specific	O
,	O
the	O
function	O
serialize	B-Application
serializes	B-Application
an	O
R	B-Language
object	O
to	O
a	O
connection	O
,	O
the	O
output	O
being	O
a	O
raw	O
vector	O
coded	O
in	O
hexadecimal	O
format	O
.	O
</s>
<s>
REBOL	B-Application
REBOL	B-Application
will	O
serialize	B-Application
to	O
file	O
(	O
save/all	O
)	O
or	O
to	O
a	O
string	O
!	O
</s>
<s>
Strings	O
and	O
files	B-Operating_System
can	O
be	O
deserialized	O
using	O
the	O
polymorphic	B-Application
load	O
function	O
.	O
</s>
<s>
RProtoBuf	O
provides	O
cross-language	O
data	B-Application
serialization	I-Application
in	O
R	B-Language
,	O
using	O
Protocol	B-Protocol
Buffers	I-Protocol
.	O
</s>
<s>
Ruby	B-Language
Ruby	B-Language
includes	O
the	O
standard	O
module	O
Marshal	O
with	O
2	O
methods	B-Language
dump	B-Application
and	O
load	O
,	O
akin	O
to	O
the	O
standard	O
Unix	O
utilities	O
dump	B-Application
and	O
restore	O
.	O
</s>
<s>
These	O
methods	B-Language
serialize	B-Application
to	O
the	O
standard	O
class	O
String	O
,	O
that	O
is	O
,	O
they	O
effectively	O
become	O
a	O
sequence	O
of	O
bytes	O
.	O
</s>
<s>
Some	O
objects	O
cannot	O
be	O
serialized	O
(	O
doing	O
so	O
would	O
raise	O
a	O
TypeError	O
exception	O
)	O
:	O
bindings	O
,	O
procedure	O
objects	O
,	O
instances	O
of	O
class	O
IO	B-Application
,	O
singleton	O
objects	O
and	O
interfaces	B-Application
.	O
</s>
<s>
If	O
a	O
class	O
requires	O
custom	O
serialization	B-Application
(	O
for	O
example	O
,	O
it	O
requires	O
certain	O
cleanup	O
actions	O
done	O
on	O
dumping	O
/	O
restoring	O
)	O
,	O
it	O
can	O
be	O
done	O
by	O
implementing	O
2	O
methods	B-Language
:	O
_dump	O
and	O
_load	O
.	O
</s>
<s>
The	O
instance	B-Language
method	I-Language
_dump	O
should	O
return	O
a	O
String	O
object	O
containing	O
all	O
the	O
information	O
necessary	O
to	O
reconstitute	O
objects	O
of	O
this	O
class	O
and	O
all	O
referenced	O
objects	O
up	O
to	O
a	O
maximum	O
depth	O
given	O
as	O
an	O
integer	O
parameter	O
(	O
a	O
value	O
of	O
-1	O
implies	O
that	O
depth	O
checking	O
should	O
be	O
disabled	O
)	O
.	O
</s>
<s>
Rust	B-Application
Serde	O
is	O
the	O
most	O
widely	O
used	O
library	O
,	O
or	O
crate	O
,	O
for	O
serialization	B-Application
in	O
Rust	B-Application
.	O
</s>
<s>
Smalltalk	B-Application
In	O
general	O
,	O
non-recursive	O
and	O
non-sharing	O
objects	O
can	O
be	O
stored	O
and	O
retrieved	O
in	O
a	O
human	B-General_Concept
readable	I-General_Concept
form	O
using	O
the	O
storeOn:/readFrom	O
:	O
protocol	O
.	O
</s>
<s>
The	O
storeOn	O
:	O
method	O
generates	O
the	O
text	O
of	O
a	O
Smalltalk	B-Application
expression	O
which	O
-	O
when	O
evaluated	O
using	O
readFrom	O
:	O
-	O
recreates	O
the	O
original	O
object	O
.	O
</s>
<s>
However	O
,	O
in	O
its	O
original	O
form	O
,	O
it	O
does	O
not	O
handle	O
cyclic	O
data	B-General_Concept
structures	I-General_Concept
or	O
preserve	O
the	O
identity	O
of	O
shared	O
references	O
(	O
i.e.	O
</s>
<s>
Some	O
of	O
them	O
are	O
specific	O
to	O
a	O
particular	O
Smalltalk	B-Application
implementation	O
or	O
class	O
library	O
.	O
</s>
<s>
There	O
are	O
several	O
ways	O
in	O
Squeak	B-Operating_System
Smalltalk	I-Operating_System
to	O
serialize	B-Application
and	O
store	O
objects	O
.	O
</s>
<s>
Both	O
provide	O
a	O
so-called	O
"	O
binary-object	O
storage	O
framework	O
"	O
,	O
which	O
support	O
serialization	B-Application
into	O
and	O
retrieval	O
from	O
a	O
compact	O
binary	O
form	O
.	O
</s>
<s>
However	O
,	O
the	O
Smalltalk/X	O
code	O
is	O
open	O
source	O
and	O
free	O
and	O
can	O
be	O
loaded	O
into	O
other	O
Smalltalks	B-Application
to	O
allow	O
for	O
cross-dialect	O
object	O
interchange	O
.	O
</s>
<s>
Object	B-Application
serialization	I-Application
is	O
not	O
part	O
of	O
the	O
ANSI	O
Smalltalk	B-Application
specification	O
.	O
</s>
<s>
As	O
a	O
result	O
,	O
the	O
code	O
to	O
serialize	B-Application
an	O
object	O
varies	O
by	O
Smalltalk	B-Application
implementation	O
.	O
</s>
<s>
For	O
instance	O
,	O
a	O
serialized	B-Application
object	I-Application
created	O
in	O
Squeak	B-Operating_System
Smalltalk	I-Operating_System
cannot	O
be	O
restored	O
in	O
Ambrai	O
Smalltalk	B-Application
.	O
</s>
<s>
Consequently	O
,	O
various	O
applications	O
that	O
do	O
work	O
on	O
multiple	O
Smalltalk	B-Application
implementations	O
that	O
rely	O
on	O
object	B-Application
serialization	I-Application
cannot	O
share	O
data	O
between	O
these	O
different	O
implementations	O
.	O
</s>
<s>
These	O
applications	O
include	O
the	O
MinneStore	O
object	O
database	O
and	O
some	O
RPC	B-Operating_System
packages	O
.	O
</s>
<s>
A	O
solution	O
to	O
this	O
problem	O
is	O
SIXX	O
,	O
which	O
is	O
a	O
package	O
for	O
multiple	O
Smalltalks	B-Application
that	O
uses	O
an	O
XML-based	O
format	O
for	O
serialization	B-Application
.	O
</s>
<s>
Swift	B-Application
The	O
Swift	B-Application
standard	O
library	O
provides	O
two	O
protocols	O
,	O
Encodable	O
and	O
Decodable	O
(	O
composed	O
together	O
as	O
Codable	O
)	O
,	O
which	O
allow	O
instances	O
of	O
conforming	O
types	O
to	O
be	O
serialized	O
to	O
or	O
deserialized	O
from	O
JSON	B-General_Concept
,	O
property	B-Application
lists	I-Application
,	O
or	O
other	O
formats	O
.	O
</s>
<s>
Windows	B-Application
PowerShell	I-Application
Windows	B-Application
PowerShell	I-Application
implements	B-Language
serialization	B-Application
through	O
the	O
built-in	O
cmdlet	O
Export-CliXML	O
.	O
</s>
<s>
Export-CliXML	O
serializes	B-Application
.NET	B-Application
objects	O
and	O
stores	O
the	O
resulting	O
XML	B-Protocol
in	O
a	O
file	O
.	O
</s>
<s>
To	O
reconstitute	O
the	O
objects	O
,	O
use	O
the	O
Import-CliXML	O
cmdlet	O
,	O
which	O
generates	O
a	O
deserialized	O
object	O
from	O
the	O
XML	B-Protocol
in	O
the	O
exported	O
file	O
.	O
</s>
<s>
Deserialized	O
objects	O
,	O
often	O
known	O
as	O
"	O
property	O
bags	O
"	O
are	O
not	O
live	O
objects	O
;	O
they	O
are	O
snapshots	O
that	O
have	O
properties	O
,	O
but	O
no	O
methods	B-Language
.	O
</s>
<s>
Two	O
dimensional	O
data	B-General_Concept
structures	I-General_Concept
can	O
also	O
be	O
(	O
de	O
)	O
serialized	O
in	O
CSV	O
format	O
using	O
the	O
built-in	O
cmdlets	O
Import-CSV	O
and	O
Export-CSV	O
.	O
</s>
