Created
December 12, 2021 12:43
-
-
Save navi2589/8c86f81d6ce1a618e54063b905e690dc to your computer and use it in GitHub Desktop.
Example Of Jayway Jsonpath Library Usage.
This file contains 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
public class JaywayJsonpathUsage { | |
/* | |
Given a below json. main method will extract value of json attibute a and prints its value. | |
{ | |
"a": 1, | |
"b": 2 | |
} | |
*/ | |
public static void main(String[] args) { | |
JsonObject jsonObject = new JsonObject("{\"a\": 1,\"b\":2}"); | |
System.out.println("Printing value of a " + JsonPath.parse(jsonObject.toString()).read("a").toString()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment