Retrieve JSON data returned from GOOGLE FINANCE API URL in android

拟墨画扇 提交于 2019-12-08 05:17:29

问题


I am using the following URL to get quotes information of any company. http://finance.google.com/finance/info?client=ig&q=bom:ranbaxy

(here ranbaxy is the company).

what website or url returns is given below.

[ {
"id": "672832" ,
"t" : "500359" ,
"e" : "BOM" ,
"l" : "859.90" ,
"l_fix" : "859.90" ,
"l_cur" : "Rs.859.90" ,
"s": "0" ,
"ltt":"3:50PM GMT+5:30" ,
"lt" : "Apr 1, 3:50PM GMT+5:30" ,
"lt_dts" : "2015-04-01T15:50:23Z" ,
"c" : "" ,
"c_fix" : "" ,
"cp" : "" ,
"cp_fix" : "" ,
"ccol" : "" ,
"pcls_fix" : "859.9" 
} ]

in the following returned json values objectname or array name is not given . i am unable to retrieve the data from this url.

i just want to show each data in TextView. i have extended AsyncTask in the class where i am getting the values.

need the solution for it. thanks in Advance.


回答1:


This looks like a json array. use

JSONArray jsar=new JSONArray(result);

Then use for loop to parse.Also, take a look at this

Hope this helps



来源:https://stackoverflow.com/questions/32825589/retrieve-json-data-returned-from-google-finance-api-url-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!