more complex example for JSON object return
This commit is contained in:
parent
a0413b2a48
commit
7d982eec0b
1 changed files with 16 additions and 0 deletions
|
@ -17,4 +17,20 @@ public class DocuSphereApplication {
|
||||||
public String helloWorld() {
|
public String helloWorld() {
|
||||||
return "Hello World!";
|
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) {}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue