json.dumps() converts a dictionary to str object, not a json(dict) object! So you have to load your str into a dict to use it by using json.loads() method

See json.dumps() as a save method and json.loads() as a retrieve method.

This is the code sample which might help you understand it more:

import json

r = {'is_claimed': 'True', 'rating': 3.5}
r = json.dumps(r)
loaded_r = json.loads(r)
loaded_r['rating'] #Output 3.5
type(r) #Output str
type(loaded_r) #Output dict
Answer from Iman Mirzadeh on Stack Overflow
Discussions

How to serialize Python dict to JSON - Stack Overflow
If you try to serialize any data type which is not json serializable, you get a TypeError "TypeError: is not JSON serializable". So there should be an intermediate step that converts these non built in data types into Python built in serializable data structure (list, dict, number and string). More on stackoverflow.com
🌐 stackoverflow.com
python - How do I put a dictionary into JSON without the escape slash - Stack Overflow
Then you need to pass your printJSON function a dict, not a string, which is what you are currently doing. ... Thanks, Scott, for including a minimal reproducible example in your question. ... The reason is because you are dumping your JSON data twice. Once outside the function and another ... More on stackoverflow.com
🌐 stackoverflow.com
convert list of dictionary to list of json objects
Json.dumps will convert the dictionary to a string but the string is valid JSON. You see the single quotes since Python is indicating this is a string (and double quotes is being used internally). More on reddit.com
🌐 r/learnpython
7
2
October 13, 2022
What's the real difference between a dict and a JSON object (coming from JS background)
JSON is a file format that uses a key - value pair syntax. Keys can only be unicode strings surrounded by doubel quotes, like "name". Values can be: Only certain number formats like 5, -5, 5.5, 1.0E+5 The values true, false, and null Unicode strings in double quotes, like "hello" Array: an ordered, comma separated list of any valid value type Object: a collection of key-value pairs that itself confirms to the JSON syntax ---------------------------------- A Python dict is an object that can have any hashable object as a key. It’s more flexible. A number, a decimal, a string, a tuple, etc can be a key. A Python dict value has no limits (that I know of). It can be any Python object. A string, a number, a function, another dict, a whole entire module. You name it. ---------------------------------- What makes JSON so powerful is that it's an agreed upon format. No matter if you're using Python, Java, PHP, or Ruby, if someone sends your app data in the JSON format, the shape is predictable so your programming language of choice will be able to parse it. How Java, Python, JavaScript, etc. decide to parse JSON into an object will be a little different depending on the language. Python can decode a string or file that confirms to the JSON format into a Python dict. ---------------------------------- One nuance that I wanted to point out is even though JSON stands for "JavaScript Object Notation", it is NOT JavaScript. JSON is a file format/data exchange format. Someone said "So 1 and 1.0 are two different values in Python, while in JSON, they would be the same." That's not quite true. JSON is only a format. 1 and 1.0 in a json file are no more "the same" as 1 and 1.0 are in a txt file. What that person probably meant is that 1 and 1.0 are the same in JavaScript, but that's besides the point because it's important to remember that JSON is NOT JavaScript, it's a format. More on reddit.com
🌐 r/learnpython
9
3
October 9, 2022
🌐
GeeksforGeeks
geeksforgeeks.org › python › how-to-convert-python-dictionary-to-json
How To Convert Python Dictionary To JSON? - GeeksforGeeks
July 12, 2025 - json.dump() writes a dictionary directly into a file in JSON format. It avoids the need to manually open and write the JSON string to a file. Additional options like indentation and key sorting can be applied to make the output more structured.
🌐
Spark By {Examples}
sparkbyexamples.com › home › python › convert python dictionary to json
Convert Python Dictionary to JSON - Spark By {Examples}
May 31, 2024 - We can use the json.dump() method and json.dumps() method to convert a dictionary to a JSON string. ... JSON stands for JavaScript Object Notation and is used to store and transfer data in the form of text.
🌐
Board Infinity
boardinfinity.com › blog › dict-to-json-in-python
Dictionary to JSON: Conversion in Python | Board Infinity
January 2, 2025 - Serialization of Unsupported Types: Error: The error message is often as - "TypeError: Object of type X is not JSON serializable" Solution: Include the default parameter in json.dumps() so as to handle instances of custom types. Circular References: Objects with reference to objects containing them can lead to the creation of endless circles during serialization. Do not organize your code in such structures as flattened or refactored. Encoding and Decoding Issues: It is recommended to enforce always creating a new encoding/decoding to support internationalization, for instance, UTF-8. Python dict to JSON is crucial for any Python developer, especially when handling APIs, data and storage systems, or distributed systems.
Find elsewhere
🌐
Dict2json
dict2json.com
Python Dict to JSON Converter Online
Convert Python dictionaries to JSON format online. Paste your Python dict and get the equivalent JSON output instantly.
🌐
Quora
quora.com › How-can-we-convert-a-Python-nested-dictionary-to-a-JSON-file
How can we convert a Python nested dictionary to a JSON file? - Quora
To sort keys alphabetically: json.dump(data, f, sort_keys=True, indent=2) ... These steps convert nested Python dictionaries to JSON files reliably, while addressing common needs: readability, encoding, non-serializable types, memory constraints, and key ordering.
🌐
GeeksforGeeks
geeksforgeeks.org › python › convert-json-to-dictionary-in-python
Convert JSON to dictionary in Python - GeeksforGeeks
July 12, 2025 - In the below code, firstly we open the "data.json" file using file handling in Python and then convert the file to Python object using the json.load() method we have also print the type of data after conversion and print the dictionary.
🌐
Hevodata
docs.hevodata.com › pipelines › transformations › python-transfm › utils › convert-python-dictionary-object-to-json-string
Convert Python Dictionary Object to JSON String - Hevo Data
from io.hevo.api import Event from io.hevo.api import Utils def transform(event): eventName = event.getEventName() properties = event.getProperties() customer_keys = ['name', 'location', 'exp'] customer = {} for key in customer_keys: customer[key] = properties[key] del properties[key] customer_str = Utils.dictToJsonString(customer) properties['customer'] = customer_str return event · The name, location, and exp fields and their values are displayed in the customer field as a JSON string.
🌐
KDnuggets
kdnuggets.com › convert-python-dict-to-json-a-tutorial-for-beginners
Convert Python Dict to JSON: A Tutorial for Beginners - KDnuggets
In this tutorial, we’ll learn how to convert a Python dictionary to JSON using the built-in json module.
🌐
Code Beautify
codebeautify.org › python-formatter-beautifier
Python Formatter and Beautifier
python-formatter-beautifier?input= print("Hello, World!") Related Tools · HTML Formatter CSS Formatter CSS Validator JS Beautifier · Recently visited pages · Tags · Formatters · Buy us a Coffee JSON Formatter FAQ Privacy Policy Content Policy About Contact History Where am I right now?
🌐
Pythondictionary
pythondictionary.org › home › json & dictionaries
Working with JSON and Python Dictionaries | PythonDictionary.org | PythonDictionary.org
January 6, 2025 - import json # Write dictionary to JSON file data = {'users': [{'name': 'Alice'}, {'name': 'Bob'}]} with open('data.json', 'w') as f: json.dump(data, f, indent=2) # Read JSON file to dictionary with open('data.json', 'r') as f: loaded_data = json.load(f) print(loaded_data) # {'users': [{'name': ...
🌐
Codedamn
codedamn.com › news › python
How To Convert A Dictionary To JSON in Python?
March 16, 2023 - The only rule in these is that we must wrap all of the keys in double quotes at the end; a comma will result in invalid JSON data. We can’t access it like a dictionary because it’s a string, so you need to convert it to something that Python will understand, and that’s done by using the JSON library, so we have to import the JSON library.
🌐
Edureka Community
edureka.co › home › community › categories › python › is it possible to save python dictionary into...
Is it possible to save python dictionary into json files | Edureka Community
September 4, 2019 - Is it possible to save python dictionary into... Reading different format files from s3 having decoding issues using boto3 May 17, 2024 · What is the algorithm to find the sum of prime numbers in the input in python Feb 22, 2024
🌐
Srinimf
srinimf.com › 2023 › 07 › 10 › python-methods-to-format-dictionary-to-json-quickly
3 Ways to Convert Python Dictionary into JSON Format – Srinimf
October 19, 2023 - Using the json Module Python provides the built-in json module, which offers a straightforward way to convert dictionaries to JSON format(Python dict to json). The module includes the json.dumps() function (json dumps method), which serializes ...
🌐
AskPython
askpython.com › home › how to convert dictionary into json in python?
How to convert Dictionary into JSON in Python? - AskPython
July 27, 2022 - #Dictionary in python is built-in datatype so #no need to import anything. dict1 = { 'One' : 1, 'Two' : 2, 'C': 3} Python does have a default module called “json” that helps us to convert different data forms into JSON.
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-dict-of-tuples-to-json
Python - Dict of tuples to JSON - GeeksforGeeks
July 23, 2025 - # import json module from google.colab import files import json # dictionary of employee data data = { "id": ("1", "2", "3"), "name": ("bhanu", "sivanagulu"), "department": ("HR", "IT") } # convert into json # file name is mydata with open("mydata.json", "w") as final: json.dump(data, final) # download the json file files.download('mydata.json')