I am trying to read a json
file, and from it, a double, but I came across NullPointerException
in the following situation, while there is no apparent error in it.
double longitude = (double) json_restaurant.get("longitude");
error:
java.lang.NullPointerException
I tried to check if it wasn't working, by calling System.out.println(longitude)
after the above-mentioned code snippet, and the terminal does display the correct value of longitude
.
Where am I going wrong, if anywhere?