How to read JSON file in PythonJSON stands for JavaScript Object Notation, which is a popular data format to represent the structured data. It is an effective way to transmit the data between the server and web-applications. The data representation in JSON is similar to the Python dictionary. The example is given below. Example - Read JSON fileFirst, we need to import the json module, and it provides the load() function to read the JSON file. Suppose, we have a JSON file named student.json, which contains JSON objects. Let's understand the following example. Output: {"name": "Peter", "Subjects": ["English", "Political Science"]} Explanation -In the above code, we have used the open() function to read the JSON file. The load() function is parsed the JSON file and returned the dictionary named data.
Next TopicHow to read a text file in Python
|
JavaTpoint offers too many high quality services. Mail us on h[email protected], to get more information about given services.
JavaTpoint offers college campus training on Core Java, Advance Java, .Net, Android, Hadoop, PHP, Web Technology and Python. Please mail your requirement at [email protected].
Duration: 1 week to 2 week