import flexjson.JSONDeserializer; import flexjson.JSONSerializer; public class Example { private String name; private int age; public Example() {} public Example(String name, int age) { this.name = name; this.age = age; } public static void main(String[] args) { Example example = new Example("John", 25); String json = new JSONSerializer().serialize(example); System.out.println("Serialized JSON: " + json); Example deserializedExample = new JSONDeserializer<Example>().deserialize(json, Example.class); System.out.println("Deserialized Example: " + deserializedExample.getName() + ", " + deserializedExample.getAge()); } }


上一篇:
下一篇:
切换中文