package gr.aueb.dmst.dds.example;
import com.google.gson.Gson;
record Person(String name, int age) {}
public class JsonIO {
public static void main(String[] args) {
Gson gson = new Gson();
// Read a JSON object
String json = "{\"name\":\"Anna\", \"age\":25}";
Person person = gson.fromJson(json, Person.class);
System.out.println("Read Person: " + person);
// Serialize a Java object into JSON
String serializedJson = gson.toJson(person);
System.out.println("Serialized JSON: " + serializedJson);
}
}