Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android parsing org.json.JSONObject object has no "getFloat" method. What do I do?

Tags:

json

android

In my app I'm creating a JSON object. Somewhere along the way I insert floats (location longitude and latitude) in it.

Then send it to server.

When I get it from the server and try parsing it, I realized there is no getFloat method?

Will getInt do the job or should I save it as a String?

like image 429
Kaloyan Roussev Avatar asked Dec 02 '25 17:12

Kaloyan Roussev


1 Answers

JSONObject object has no “getFloat” method. What do I do?

with JSON you use getDouble() (docs)

like image 81
Marcin Orlowski Avatar answered Dec 05 '25 07:12

Marcin Orlowski



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!