How to parse the Json response in android?

后端 未结 6 1776
一生所求
一生所求 2020-12-14 23:19

i m getting this response in a result of GET request to server

{\"LL\": { \"control\": \"dev/sys/getkey\", \"value\": \"4545453030304138303046392035343733373         


        
6条回答
  •  执念已碎
    2020-12-14 23:35

    You can parse your response and get value try this:

    try {
      JSONObject jsonObject = new JSONObject(response);// Convert response string in to json object.
    
      JSONObject jsonLL = jsonObject.getJSONObject("LL");// Get LL json object from jsonObject.
    
      String strValue = jsonLL.getString("value");// Get value from jsonLL Object.
    
       } catch (Exception e) {
        e.printStackTrace();
       }
    

提交回复
热议问题