json.loads() in Python Last Updated : 09 May, 2025 Summarize Suggest changes Share Like Article Like Report JSON is a lightweight data format used for storing and exchanging data across systems. Python provides a built-in module called json to work with JSON data easily. The json.loads() method of JSON module is used to parse a valid JSON string and convert it into a Python dictionary. For example: Python import json s = '{"language": "Python", "version": 3.11}' p = json.loads(s) print(p) Output{'language': 'Python', 'version': 3.11} Explanation:The data variable contains a JSON-formatted string.json.loads(s) parses the string and returns a Python dictionary.Now we can access values like p['language'] or p['version'].In this article, we'll learn about the json.loads() method, how it works and practical examples to parse JSON strings into Python objects:Syntaxjson.loads(s)Parameters:s: A valid JSON string (can be of type str, bytes, or bytearray)Return Type: An Python object (typically a dict, but can also be a list, int, float, str, etc., based on the JSON structure)Examples of json.loads() methodExample 1: Basic JSON ParsingLet’s assume, we have a JSON string containing personal information. The below code demonstrates how to convert it to a Python dictionary. Python import json x = """{ "Name": "Prajjwal Vish", "Contact Number": 1111111111, "Email": "prajjwal@gmail.com", "Hobbies": ["Reading", "Sketching", "Playing Chess"] }""" y = json.loads(x) print(y) Output{'Name': 'Prajjwal Vish', 'Contact Number': 1111111111, 'Email': 'prajjwal@gmail.com', 'Hobbies': ['Reading', 'Sketching', 'Playing Chess']} Explanation:The multi-line string x contains valid JSON.json.loads(x) converts it into a Python dictionary.Example 2: Iterating Over Parsed DataOnce parsed, we can loop through the dictionary just like any other Python dict: Python import json e = '{"id": "09", "name": "Nitin", "department": "Finance"}' e_dict = json.loads(e) for key in e_dict: print(key, ":", e_dict[key]) Outputid : 09 name : Nitin department : Finance Explanation:The JSON string employee is converted to a Python dictionary.We then loop through each key and print its corresponding value.Related Article:json.load() in PythonDifference Between json.load() and json.loads() Advertise with us Next Article json.dump() in Python M manandeep1610 Follow Similar Reads json.load() in Python json.load() function in Python is used to read a JSON file and convert it into a Python object, such as a dictionary or a list. JSON (JavaScript Object Notation) represents data as key/value pairs, where keys are strings and values can be different JSON data types.Syntaxjson.load(file_object)Paramet 3 min read json.loads() vs json.loads() in Python orjson.loads() and json.loads() are both Python methods used to deserialize (convert from a string representation to a Python object) JSON data. orjson and json are both Python libraries that provide functions for encoding and decoding JSON data. However, they have some differences in terms of perfo 4 min read json.dump() in Python json.dump() method in Python is used to serialize a Python object into a JSON formatted string and write it directly into a file. This method is part of the built-in json module, which is useful when you need to save Python data structures like dictionaries or lists in JSON format.Syntaxjson.dump(ob 5 min read Python JSON Python JSON JavaScript Object Notation is a format for structuring data. It is mainly used for storing and transferring data between the browser and the server. Python too supports JSON with a built-in package called JSON. This package provides all the necessary tools for working with JSON Objects i 3 min read numpy.load() in Python numpy.load() function return the input array from a disk file with npy extension(.npy). Syntax : numpy.load(file, mmap_mode=None, allow_pickle=True, fix_imports=True, encoding='ASCII') Parameters: file : : file-like object, string, or pathlib.Path.The file to read. File-like objects must support the 2 min read json.dumps() in Python json.dumps() is a function in Pythonâs json module that converts a Python object into a JSON formatted string. It allows you to serialize Python objects such as dictionaries, lists, and more into JSON format.Syntaxjson.dumps(obj, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True 5 min read Article Tags : Python Python-json Practice Tags : python Like