more complex example for JSON object return

This commit is contained in:
Mika Bomm 2024-08-29 21:18:59 +02:00
parent a0413b2a48
commit 7d982eec0b

View file

@ -17,4 +17,20 @@ public class DocuSphereApplication {
public String helloWorld() {
return "Hello World!";
}
@GetMapping("/")
private SomeImportantData index() {
return new SomeImportantData(
"Important keep secret",
new Person("SomeObscure Person", 96,
new FavLanguage("Java", true, 'J') //Although the compiled status is a lie i mean kind of
)
);
}
record SomeImportantData(String name, Person person) {}
record Person(String name, int age, FavLanguage favLanguage) {}
record FavLanguage(String name, Boolean compiled, Character FirstCharacter) {}
}