JAVA
I want to parse every element of JSON file (using gson will be the best) to Array. I searched for two days and I still can't figure out how to do it correctly. My JSON file looks like this:
{
"spawn1": {
"x": 336.4962312645427,
"y": 81.0,
"z": -259.029426052796
},
"spawn2": {
"x": 341.11558917719424,
"y": 80.0,
"z": -246.07415114625
}
}
There will be more and more elements with different names. What I need is to take all the elements like x, y, z and create an object using it and place it to the array. Class for this object looks like this:
public class Chest {
private double x, y, z;
public Chest(double x, double y, double z) {
this.x = x;
this.y = y;
this.z = z;
}
}