Skip to content

Instantly share code, notes, and snippets.

@navi2589
Created December 12, 2021 12:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save navi2589/8c86f81d6ce1a618e54063b905e690dc to your computer and use it in GitHub Desktop.
Save navi2589/8c86f81d6ce1a618e54063b905e690dc to your computer and use it in GitHub Desktop.
Example Of Jayway Jsonpath Library Usage.
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