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.

Serialization is the process of converting a or object's state into a format that can be stored (for example, in a flat file or memory ) or transmitted over a network, to be reconstructed later maintaining data integrity - typically in a different run-time environment which may or may not be on the same computer.

The process of serializing an object is sometimes referred to as - however depending on the context / language this term may take on a slightly different meaning. The process of reconstructing a data structure from its serialized form is known as .

Popular formats for serialization are and .

33160 questions
11
votes
1 answer

How to serialize custom user model in DRF

I have made a custom user model,by referring the tutorial , this is how I serialize the new user model: Serializers.py from django.conf import settings User = settings.AUTH_USER_MODEL class UserSerializer(serializers.ModelSerializer): post =…
11
votes
8 answers

Any reason not to use XmlSerializer?

I just learned about the XmlSerializer class in .Net. Before I had always parsed and written my XML using the standard classes. Before I dive into this, I am wondering if there are any cases where it is not the right option. EDIT: By standard…
JimDaniel
  • 12,513
  • 8
  • 61
  • 67
11
votes
4 answers

Android Realm - Passing Realm object using Intent

I want to pass a realm object from one activity to another. e.g. Intent intent = new Intent(MainActivity.this, Second.class); intent.putExtra("Student", studentObj); // studentObj is a realm object startActivity(intent); And receive it from the…
Ezio
  • 121
  • 1
  • 7
11
votes
1 answer

Make clos objects printable in lisp

If you want to make CLOS objects in common lisp printable (print readably), how do you go about doing this without using anything but print and read.
krzysz00
  • 2,083
  • 12
  • 24
11
votes
2 answers

Spring Boot ignores @JsonDeserialize and @JsonSerialize

I've a Spring Boot application with RESTful endpoints that I want to add custom serializers to for joda-time but I can't get the applications default Jackson serailzier to recognize my custom one's. I created RESTFul endpoints using…
Schokea
  • 708
  • 1
  • 9
  • 28
11
votes
4 answers

How to perform partial object serialization providing "paths" using Newtonsoft JSON.NET

I have a situation in which I have a very large C# object, however, I only need to return a handful of properties (which can be on nested objects), allow for client-side JavaScript to modify those properties and then send the resulting object back…
JFalcon
  • 179
  • 1
  • 10
11
votes
2 answers

Spark non-serializable exception when parsing JSON with json4s

I've run into an issue with attempting to parse json in my spark job. I'm using spark 1.1.0, json4s, and the Cassandra Spark Connector. The exception thrown is: java.io.NotSerializableException: org.json4s.DefaultFormats Examining the…
worker1138
  • 2,071
  • 5
  • 29
  • 36
11
votes
1 answer

Jackson JSON - Deserialize Commons MultiMap

i want to serialize and deserialize a MultiMap (Apache Commons 4) using JSON. Piece of code to test: MultiMap map = new MultiValueMap<>(); map.put("Key 1", "Val 11"); map.put("Key 1", "Val 12"); map.put("Key 2", "Val…
JDC
  • 4,247
  • 5
  • 31
  • 74
11
votes
1 answer

Is numpy.save cross platform?

Suppose I save a numpy array to a file, "arr.npy", using numpy.save() and that I do this using a particular python version, numpy version, and OS. Can I load, using numpy.load(), arr.npy on a different OS using a different version of python or…
waldol1
  • 1,841
  • 2
  • 18
  • 22
11
votes
2 answers

How to apply indenting serialization only to some properties?

I want to serialize .NET objects to JSON in a human-readable way, but I would like to have more control about whether an object's properties or array's elements end up on a line of their own. Currently I'm using JSON.NET's…
Wormbo
  • 4,978
  • 2
  • 21
  • 41
11
votes
1 answer

Serializing an interface/abstract object using NewtonSoft.JSON

One way of deserializing interface and abstract properties is a class is by setting TypeNameHandling to Auto during serialization and deserialization. However, when I try the same when serializing and deserializing an interface object directly, it…
ambivi
  • 235
  • 1
  • 3
  • 9
11
votes
1 answer

Can serialVersionUID be ignored when serializing to JSON?

Based on a question on Java's serialVersionUID, is it necessary to define serialVersionUID when the serialization is JSON? private static final long serialVersionUID = 234239427349L; I understand that when a object is binary serialized (RPC, etc),…
ankitjaininfo
  • 11,961
  • 7
  • 52
  • 75
11
votes
2 answers

how resolve java.io.InvalidClassException: local class incompatible: stream classdesc serialVersionUID

I have a class serializable in a so big project coded without specify serialVersionUID, and save in a dataBase MySQL as a blob! I have to add some fields to this class, but after doing this, I get an exception like this: IOException: error when…
ATEF CHAREF
  • 387
  • 5
  • 8
  • 18
11
votes
2 answers

Generating unique serializable id for each of the generated classes in JAXB

I am using ant wsimport to generate client stub from the wsdls. Also, I would like to generate client classes that implements Serializable. I would like to generate a different serialVersionUID for each class. I tried with the binding file that was…
javageek
  • 111
  • 1
  • 3
11
votes
4 answers

Rails ActiveModel Serializers render not null attributes

I want to use a serializer that renders not null attributes class PersonSerializer < ActiveModel::Serializer attributes :id, :name, :phone, :address, :email end Is this possible. Many thanks. Solution: class PersonSerializer <…