How to parse the JSON response in Blackberry/J2ME?

前端 未结 6 729
广开言路
广开言路 2020-12-01 16:46

I want to parse the response coming from the server in JSON format. I have done some googling but i can\'t find any library or jar kind of thing.

Everywhere there is

6条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-01 17:36

    When you got response string then use this code

    try { 
            JSONObject jsonres = new JSONObject(jsons);
            System.out.println("Preview icon from jsonresp:"+jsonres.getString("mydata"));
        } catch (JSONException ex) {
            Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
        }
    

    one thing jsons is your response string which is in json format & mydata your key of data so you can get your data from JSONObject. Thnks

提交回复
热议问题