<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20210307</version>
</dependency>
import org.json.JSONObject;
JSONObject jsonObject = new JSONObject();
jsonObject.put("age", 25);
JSONObject jsonObject = new JSONObject(jsonString);
String name = jsonObject.getString("name");
int age = jsonObject.getInt("age");
String city = jsonObject.getString("city");
String jsonString = jsonObject.toString();
System.out.println(jsonString);
JSONObject nestedObject = jsonObject.getJSONObject("nestedObject");
String nestedName = nestedObject.getString("name");