JSON.stringify in java - android

后端 未结 3 2005
天命终不由人
天命终不由人 2021-01-03 22:43

Is there any way to perform a JSON.stringify in android?

I keep seeing JSON.stringify(JSONObject) all around the web, but I cant find the J

3条回答
  •  梦毁少年i
    2021-01-03 23:24

    Basic actions with JSON objects in JAVA can be done either with a help of org.json package (included in Android SDK) or javax.json (part of JAVA EE). Both of them have toString() method for conversion of JSONObject to string:

    //assuming you have object `jsonobject` of class `JSONObject`
    String output = jsonobject.toString()
    

提交回复
热议问题