> Want to download all the comments with the user info for every user? You have a choice between repeating the user info per comment, requesting the comments first then the users by id (two requests) or using a serialisation mechanism that supports object references (isn't pure JSON)
Or you send it like
{
"users": [
{
"id": "de305d54-75b4-431b-adb2-eb6b9e546014",
"name": "Max Mustermann",
"image": "https://news.ycombinator.com/y18.gif"
},
...
],
"comments": [
{
"user": "de305d54-75b4-431b-adb2-eb6b9e546014",
"time": "2015-10-15T18:51:04.782Z",
"text": "Or you can do this"
},
...
]
}
Which is a standard way to do it that works here, too. Because you can have references in JSON, you just have to do them yourself.