Answer the question
In order to leave comments, you need to log in
How to parse JSON with different data structure (java)?
Previously, I did not have to work with JSON, but now there is a task:
We need to load a JSON file with the following data for further work. For example, sort them into categories in a dropdownlist.
The data itself is some Points of interests of the following format
[{
"type": "amenity",
"name": "Uni",
"address": "test 11",
"lat": 49.8670679,
"lon": 8.6346578,
"icon": "test.jpg"
},
{ "type": "fuel",
"name": "jet",
"address": "test75",
"lat": 49.8796429,
"lon": 8.5743928
},
{ "type": "pub",
"name": "La Bodega",
"address": "test34",
"capacity": 120,
"lat": 49.879903,
"lon": 8.6454108
}]
Answer the question
In order to leave comments, you need to log in
And how are you going to distribute data across classes without conditions in one form or another? If the operator if
were so terrible, then they would have got rid of it long ago, as well as from goto
.
You can do it elegantly and universally - do it. But more often there is a choice - either beautiful or comfortable.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question