Reputation: 51
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
.
Upvotes: 5
Views: 3464
Reputation: 11026
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);
Upvotes: 0
Reputation: 3084
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.
Upvotes: 2