KJW KJW - 8 months ago 62
Java Question

Java: serialize TreeModel, TableModel to JSON, and vice versa?

On the client side, a user specified input creates a unique TreeModel and TableModel.

This needs to be serialized to JSON for storage on MongoDB (stores JSON document directly).

The JSON needs to be parsed back into a TreeModel or TableModel which will be rendered again on the client side software.

Any library or existing codes which can faciliate this?


TreeModel and TableModel are just interfaces without data therefore they cant be serialized. However when you talk about TreeModel implementation e.g. DefaultTreeModel you can serialize it to Json using Jackson POJO data binding