xxxxxxxxxx
import org.json.JSONObject;
public class JsonManipulationExample {
public static void main(String[] args) {
// Create a sample JSON object
String jsonString = "{\"name\": \"John\", \"age\": 30, \"city\": \"New York\"}";
JSONObject jsonObject = new JSONObject(jsonString);
System.out.println("Original JSON: " + jsonObject);
// Remove a key-value pair
jsonObject.remove("age");
System.out.println("JSON after removing 'age': " + jsonObject);
}
}