Importance Of JSONPath | JSONPath Vs XPath | Retrieve Data Using JSONPath Expressions



JSONPath, JSONPath VS XPATH, XPATH, retrive data from JSON using JSONPath, json syntax

Agenda:

1) What is JSONPath
2) Difference between JSONPath and XPath
3) JSONPath & XPath Expressions and Syntax
4) How retrieve data from JSON using JSON   Path
    Practical Demo

1) What is JSONPath 
  • JSONPath is a query language for the JSON, similar to XPATH for XML.
  • JSONPath uses special notation to represent nodes and their connections to adjacent nodes in a JSONPath. 
  • There are two styles of notation and they are same, namely
  • Bracket : $[‘store’][‘book’][0][‘author’]
  • Dot : $.store.book[0].author
  • Where, The dollar sign ($) represents root member object

2) Difference between JSONPath and XPath

      JSONPath :
  • JSONPath expressions always refer to a JSON structure
  • Square brackets in JSONPath operate on the object or array addressed by the previous path fragment
  • Indices always start by 0
  • E.g : $.store.book[*].author
  • Currently only single quotes allowed inside of JSONPath expressions
    XPath :
  • XPath expression are used in combination with an XML document
  • Square brackets in XPath expressions always operate on the node set resulting from the previous path fragment
  • Indices always start by 1
  • E.g : /store/book/author
  • In XPath you can use either single or double quotes

3) JSONPath & XPath Expressions and Syntax

JSONPath
XPath
Description
$
/
The root object/element
@
.
The current object/element
. Or []
/
Child operator
..
//
Recursive descent
*
*
Wildcard
[]
[]
Subscript operator
?()
[]
Filter (script) expression
n/a
()
Grouping in XPath

4) How retrieve data from JSON using JSON Path
    Practical Demo :
  • Guys for this demo have created a video on youtube channel, to watch click on below URL or on image mentioned above.
Practical Demo URL : https://youtu.be/0CvAfD9YNq8



Thanks,
The Tech HelpLine Team :)
Email ID : jobsmails18@gmail.com


Comments

Popular Post

MCQ questions for graphics class method in Java

Session 2 TestNG Framework | How to create TestNG Project In Eclipse IDE | With Selenium Test Cases

Print Hello World In Different Programming Languages | Boost Coding Skill | Developer Life

How to run Selenium script when system is locked?

How to Fix Your Connection is Not Private Error in Google Chrome | SSL Certificate Issue | JAVA | Eclipse