Converting JSON data to Java object

后端 未结 12 1091
春和景丽
春和景丽 2020-11-21 05:11

I want to be able to access properties from a JSON string within my Java action method. The string is available by simply saying myJsonString = object.getJson()

12条回答
  •  名媛妹妹
    2020-11-21 05:48

    What's wrong with the standard stuff?

    JSONObject jsonObject = new JSONObject(someJsonString);
    JSONArray jsonArray = jsonObject.getJSONArray("someJsonArray");
    String value = jsonArray.optJSONObject(i).getString("someJsonValue");
    

提交回复
热议问题