How to write a java tree Structure and Serializer / Deserializer to Json


I use spring framework.

I want to implements Java tree structure and Serializer/Deserializer to JSON.

like below JSON,

        {"id":"1","pid":"0","name":"n1", "chindren":[
            {"id":"4","pid":"1","name":"n4", "chindren":[
                {"id":"7","pid":"4","name":"n7", "chindren":[



How to convert above JSON tree to a Java class and Serializer/Deserializer to JSON

Here you can use jackson libs with your spring frame work to convert json to java classes and vice versa. For more information about jackson see this

To generate java pojo classes use this online tool click here

hope it will help you.