Answer the question
In order to leave comments, you need to log in
How to create layered json?
Good afternoon, I am writing a small program to store data received from the server in json, but there is a lot of data and I have to group them, and then internal data too. Those. you need something like this in java:
{
"server_1": {
"group_1": {
"client_1": {
"name": "George",
"position": {
"x": "12",
"y": "24",
"z": "14"
"family": {
more arrays...
}
}
}
}
}
}
Answer the question
In order to leave comments, you need to log in
You need to look at JSON objects ( { ... }
) specifically as objects in OOP, and not as an associative array. Create specific models with all the relationships between them that you are going to serialize in JSON. If you need a list of servers / groups / clients, then use the list ( [ ... ]
) of serialized models.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question