How to convert jsonString to JSONObject in Java

前端 未结 19 2997
一生所求
一生所求 2020-11-22 00:39

I have String variable called jsonString:

{\"phonetype\":\"N95\",\"cat\":\"WP\"}

Now I want to convert it into JSON Object. I

19条回答
  •  清酒与你
    2020-11-22 01:24

    Java 7 solution

    import javax.json.*;
    
    ...
    
    String TEXT;
    JsonObject body = Json.createReader(new StringReader(TEXT)).readObject()
    

    ;

提交回复
热议问题