0

I am little confused with respect to Serialization as to what it mean with respect to different contexts.

Serialization as I understand (simple terms) -> Converting the object to a form wherein it can be transferred to network / storage.

Now, i was reading JSON, and again concept of "Serialization" appeared; which said transforming Java Object -> JSON as Serialization; and vice-versa as Deserialization.

I am slightly confused at the applicability of Serialization / Deserialization with reference to different contexts.

CuriousMind
  • 8,301
  • 22
  • 65
  • 134

1 Answers1

1

Both technologies allow to serialize Java-objects to network/storage, but use different formats.

Java serialization produces a binary format, while JSON serialization produces JSON-Strings. The former one is faster but tied to Java, the later one ist slower but you can use it to exchange informations with systems not written in Java.

  • But in both cases, is Java which does the serialisation? I am not clear still :-( – CuriousMind Aug 19 '18 at 18:35
  • Yes in both cases. If you want to use java serialization, you just call ObjectOutputStream.writeObject(). In case of JSON serialization you use some java-API - Jackson for example - see https://en.wikipedia.org/wiki/Jackson_(API). –  Aug 19 '18 at 18:44