KJW KJW - 1 year ago 146
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?

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download