Created
February 18, 2023 18:06
-
-
Save jskeet/9500c6e62bdc72953c15332684fb765d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.json.JSONObject; | |
public class Test { | |
public static void main(String args[]) { | |
String json = "{ \"status\": \"failed\", \"message\": \"All fields are required\" }"; | |
JSONObject jsonObject = new JSONObject(json); | |
String status = jsonObject.getString("status"); | |
String message = jsonObject.getString("message"); | |
System.out.println("status=" + status); | |
System.out.println("message=" + message); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment