2012-04-02 30 views
0

可能重複:
JSON Parsing in Android怎麼辦JSON解析Android中

https://api.zomato.com/v1/restaurant.json/315?apikey=4f4b91f51207b8175170604f4b91f512這是我們要分析,以便我們能夠打印ID和姓名我

Web服務

我已經嘗試了很多,但無法解析和檢索數據我新的android。 PLZ給我

代碼如何,我會解析讀音字能讀這個Web服務,但數據不來格式化,因此不

能夠解析。

+0

你應該做R&d:[**的Android JSON解析**](http://stackoverflow.com/搜索?q = Android + JSON +解析) – 2012-04-02 12:11:46

+0

這是用json解析的示例代碼的最佳tutuorial。 http://www.androidhive.info/2012/01/android-json-parsing-tutorial/ – wolverine 2012-04-02 12:13:12

+0

請按照教程 - [http://www.vogella.de/articles/AndroidJSON/article.html](http: //www.vogella.de/articles/AndroidJSON/article.html)本教程解釋瞭如何檢索數據和解析數據。 – Shaiful 2012-04-02 12:09:21

回答

0

這很簡單。你有一個JSONString。你需要這樣做。

  1. 首先製作一個像這樣的JSONObject。

    JSONObject json = new JSONOBject("String you want"); // I mean the string you get from server 
    
  2. 然後給鑰匙的你想要的。

    json.get("id"); 
    

更多看到之前在這裏發帖here