Posts

Parsing JSON In Python

What is JSON? How JSON is useful in Automation? JSON stands for JavaScript Object Notation. It is easy to read and flexible text file which is a popular format used for representing the structured data. It is commonly used to receive and transmit data between server and web application in JSON format. Mainly JSON file could be used for passing the configuration details in a framework. So you need to update only one file in order to run your automation framework. Format of JSON object: { "firstname" : "Roshni" , "lastname" : "Tiwari" , "age" : 29 , } To Work with JSON, you need to import the json module of python. json module makes it easy to parse json strings and files containing json objects. import json There are three methods which are frequently used in json parsing json.dumps() json.dump() json.loads() json.load() Lets see each one with examples 1. Read JSON file import json with open ( &quo