android - How to get float value from json? -



android - How to get float value from json? -

i retrieving value jsondata

httpclient client = new defaulthttpclient(); httpconnectionparams.setconnectiontimeout(client.getparams(), 10000); httpresponse response; httpget gett = new httpget(url); response = client.execute(get); bufferedreader reader = new bufferedreader(new putstreamreader(response.getentity().getcontent(), "utf-8")); orignalresponse = reader.readline(); jsontokener tokener = new jsontokener(orignalresponse); jsonobject jsondata = new jsonobject(tokener); log.v("amount", "amount :"+jsondata.get("amount"));

i want retrieve "amount" "23868352383.00" while retrieving using

jsondata.get("amount"), gives value "2.3868352383e10",

using jsondata.getdouble("amount"), gives value "2.3868352383e10"

using jsondata.getlong("amount") removes fraction part

how can retrieve value ?? please help.

you can seek big decimal convert string float removing exponents

check it

bigdecimal.valueof(yourvaluestring);

hope help.

you can farther help here thanks

android json web-services double

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -