In this section, we are going to learn about JSON data. JSON stands for JavaScript Object Notation. JSON is a data interchange format. It encodes Python objects as JSON strings and decodes JSON strings into Python objects. Python has a JSON module that formats the JSON output. It has functions for serializing and deserializing JSON.
- json.dump(obj, fileObj): This function will serialize an object as a JSON-formatted stream.
- json.dumps(obj): This function will serialize an object as a JSON formatted string.
- json.load(JSONfile): This function will deserialize a JSON file as a Python object.
- json.loads(JSONfile): This function will deserializes a string-type JSON file to a Python object.
It also has two classes for encoding and decoding listed here:
- JSONEncoder: Used to convert Python objects into JSON format.
- JSONDecoder: Used to convert a JSON formatted...