I have an array like this:
array = [ 'charcaters' => [ 'characterName1' => [ 'blockingStance' => [ ['name' => '1.jpg', 'url' => 'http://site.com/sprites/block/1.jpg'], ['name' => '2.jpg', 'url' => 'http://site.com/sprites/block/2.jpg'], ['name' => '2.jpg', 'url' => 'http://site.com/sprites/block/3.jpg'] ], 'walkingStance' => [ ['name' => '1.jpg', 'url' => 'http://site.com/sprites/walk/1.jpg'], ['name' => '2.jpg', 'url' => 'http://site.com/sprites/walk/2.jpg'], ['name' => '2.jpg', 'url' => 'http://site.com/sprites/walk/3.jpg'] ], 'specialMoves' => [ ['name' => '1.jpg', 'url' => 'http://site.com/sprites/special/1.jpg'], ['name' => '2.jpg', 'url' => 'http://site.com/sprites/special/2.jpg'] ], ... ], 'characterName2' => [ ..... ], ... ], 'stages' => [ 'stageName1' => [ 'bridge' => [ ['name' => '1.jpg', 'url' => 'http://site.com/sprites/bridge/1.jpg'], ['name' => '2.jpg', 'url' => 'http://site.com/sprites/bridge/2.jpg'], ['name' => '2.jpg', 'url' => 'http://site.com/sprites/bridge/3.jpg'] ], 'street' => [ ['name' => '1.jpg', 'url' => 'http://site.com/sprites/street/1.jpg'], ['name' => '2.jpg', 'url' => 'http://site.com/sprites/street/2.jpg'], ['name' => '2.jpg', 'url' => 'http://site.com/sprites/street/3.jpg'] ], 'forest' => [ ['name' => '1.jpg', 'url' => 'http://site.com/sprites/forest/1.jpg'], ['name' => '2.jpg', 'url' => 'http://site.com/sprites/forest/2.jpg'] ], ... ], 'characterName2' => [ ..... ], ... ], 'other' => ... ...... ]; Many lovers obkakat PHP . However, there it is easy to create such an array and work with it. And it seems to me very convenient.
In Java, based on this data, my final object is a monster like this:
Map<String, Map<String, Map<String, ArrayList<TreeMap<String, String>>>>> Where
TreeMap<String, String> - ΡΡΠΎ ΠΊΠΎΠ½Π΅ΡΠ½ΡΠ΅ ΠΊΠ»ΡΡ-Π·Π½Π°ΡΠ΅Π½ΠΈΠ΅ ArrayList<TreeMap<String, String>> - ΡΠΏΠΈΡΠΎΠΊ ΡΡΠΈΡ
ΡΠ°ΠΌΡΡ
ΠΊΠ»ΡΡΠ΅ΠΉ ΠΈ Π·Π½Π°ΡΠ΅Π½ΠΈΠΉ Map<String, ArrayList<TreeMap<String, String>>> - ΠΊΠ»ΡΡ: Π½Π°Π·Π²Π°Π½ΠΈΠ΅ ΡΠΎΡΡΠΎΡΠ½ΠΈΡ ΠΎΠ±ΡΠ΅ΠΊΡΠ°, Π·Π½Π°ΡΠ΅Π½ΠΈΠ΅ - ΡΠΏΠΈΡΠΎΠΊ Π²ΡΡΠ΅. Map<String, Map<String, ArrayList<TreeMap<String, String>>>> - ΠΊΠ»ΡΡ: Π½Π°Π·Π²Π°Π½ΠΈΠ΅ ΠΎΠ±ΡΠ΅ΠΊΡΠ°, Π·Π½Π°ΡΠ΅Π½ΠΈΠ΅ - ΡΠΏΠΈΡΠΎΠΊ ΡΠΎΡΡΠΎΡΠ½ΠΈΠΉ Map<String, Map<String, Map<String, ArrayList<TreeMap<String, String>>>>> - ΠΊΠΎΠ½Π΅ΡΠ½ΡΠΉ ΡΠΏΠΈΡΠΎΠΊ. Horror.
Generally. Maybe I do something wrong and do it, but ...
Are there no means in Java to quickly build an associative array and preferably unlimited nesting? Is it possible to simplify this design with the help of those means so that there is no such monster? Or is it the only way?

obj.getJSONObject("someObject").getJSONArray("characters").get(0).getJSONArray("blockingStance").getJSONArray("name").are frozen out)) - Alexey ShimanskyMap<String, Map<String, Map<String, ArrayList<TreeMap<String, String>>>>>- nobody does this. All that can be allocated to the object is allocated to the object. This makes it easy to write / read code, and test, and debug. - Nofate β¦