'Is it possible to deserialize java object in javascript
In order to communicate with legacy project, I need to deserialise a Java object in a Node app.
Is it possible to deserialise Java objects in JavaScript?
The original serialization is done through Java interface Externalizable.
Solution 1:[1]
No, I don't think it is possible to do it directly.
The format of a serialized Object (either via Serializable or Externalizable) is java specific.
You have either to create a parser for the java Externalizable format or deserialize it in java and then transform it in a format like parseable with javascript like JSON using a JSON framework like jackson.
Solution 2:[2]
Although I don't know a complete and updated library to do it, I know about https://www.npmjs.com/package/java-deserialization.
It's easy to use if you don't have any fancy java class serialized.
var javaDeserialization = require("java-deserialization");
var objects = javaDeserialization.parse(buf);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Master Mind |
| Solution 2 | PhoneixS |
