Answer the question
In order to leave comments, you need to log in
How to learn how to properly build JSON architecture?
How to learn how to properly build JSON architecture? Difficulties arise when you need to create JSON from scratch. When you need to wrap in an object, when an array in an object, when just an array. Explain how to learn how to create proper JSON architecture with data?
Answer the question
In order to leave comments, you need to log in
JSON is just an object that is serialized and deserialized as a JSON string.
Therefore, the question here is not about JSON itself, but about the object representation model itself, the object model itself.
And in general, there is no correct architecture, and it is not needed. json is just a dataset, its structure is not important
That's right, whatever is convenient.
That is, convenience is the main criterion for correctness.
For example, if an object has hundreds of properties, it would be convenient to break them down into categories. If properties have numbers rather than names, then using an array is more logical than an object. Etc.
https://jsonformatter.curiousconcept.com/ - json correctness validator
https://www.json.org/json-ru.html - I studied the structure here a year ago
Look, if you need to display a lot of elements, then it's like this:
{
"response": {
"count": 1,
"items": [
{
"user_id": 1
"screen_name": "test 1",
},
{
"user_id": 2
"screen_name": "",
}
..................
]
}
}
{"response": {
"user_id": 1,
"screen_name": "test"
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question