import org.json.*; JSONObject obj = new JSONObject("{ \"name\": null, \"age\": 24 }"); if(obj.isNull("name")) { System.out.println("Name field is null"); } else { System.out.println("Name field is not null"); }In this example, a JSON object is created with a "name" field set to null, and an "age" field set to 24. The isNull() method is then used to check whether the "name" field is null or not. Since it is null, the program will output "Name field is null". The package library for this code is org.json.