How do I extract value from Json

前端 未结 8 1132
野的像风
野的像风 2020-11-30 05:23

I am getting a response String from server like below

{
  \"name\": \"Json\",
  \"detail\": {
    \"first_name\": \"Json\",
    \"last_name\": \"Scott\",
            


        
8条回答
  •  忘掉有多难
    2020-11-30 05:35

    we can use the below to get key as string from JSON OBJECT

    JsonObject json = new JsonObject(); 
     json.get("key").getAsString();
    

    this gives the string without double quotes " " in the string

提交回复
热议问题