Convert a Bundle to JSON

后端 未结 4 1749
攒了一身酷
攒了一身酷 2020-12-24 06:49

I\'d like to convert the an Intent\'s extras Bundle into a JSONObject so that I can pass it to/from JavaScript.

Is there a quick or best way to do this conversion? I

4条回答
  •  不思量自难忘°
    2020-12-24 07:32

    Object myJsonObj = bundleObject.get("yourKey");
    JsonParser parser = new JsonParser();
    JsonObject json = parser.parse(myJsonObj.toString()).getAsJsonObject();
    json.get("memberInJson").getAsString();
    

提交回复
热议问题