json.loads
take a string as input and returns a dictionary as output.
json.dumps
take a dictionary as input and returns a string as output.
With json.loads({"('Hello',)": 6, "('Hi',)": 5})
,
You are calling json.loads
with a dictionary as input.
You can fix it as follows (though I’m not quite sure what’s the point of that):
d1 = {"('Hello',)": 6, "('Hi',)": 5} s1 = json.dumps(d1) d2 = json.loads(s1)
Related Posts:
- Converting dictionary to JSON
- Convert a python dict to a string and back
- How to convert an XML string to a dictionary?
- Iterating over dictionaries using ‘for’ loops
- Why am I seeing “TypeError: string indices must be integers”?
- How do I sort a dictionary by value?
- How do I sort a dictionary by value?
- How to prettyprint a JSON file?
- How do I sort a dictionary by value?
- Check if a given key already exists in a dictionary
- How does collections.defaultdict work?
- Is a Python dictionary an example of a hash table?
- JSONDecodeError: Expecting value: line 1 column 1 (char 0)
- JSONDecodeError: Expecting value: line 1 column 1 (char 0)
- JSONDecodeError: Expecting value: line 1 column 1 (char 0)
- How to parse data in JSON format?
- Python list of dictionaries search
- How to avoid “RuntimeError: dictionary changed size during iteration” error?
- unhashable type: ‘dict’ Type Error [duplicate]
- How to copy a dictionary and only edit the copy
- json.dumps vs flask.jsonify
- How to avoid “RuntimeError: dictionary changed size during iteration” error?
- How can I remove a key from a Python dictionary?
- How to solve dictionary changed size during iteration error?
- DataFrame constructor not properly called
- TypeError: unhashable type: ‘dict’, when dict used as a key for another dict
- TypeError: ‘type’ object is not subscriptable when indexing in to a dictionary
- TypeError: ‘dict’ object is not callable
- Getting key with maximum value in dictionary?
- Error: ” ‘dict’ object has no attribute ‘iteritems’ “
- Getting key with maximum value in dictionary?
- Error: ” ‘dict’ object has no attribute ‘iteritems’ “
- How can I get dictionary key as variable directly in Python (not by searching from value)?
- Are dictionaries ordered in Python 3.6+?
- is not JSON serializable
- append multiple values for one key in a dictionary [duplicate]
- How to make a class JSON serializable
- TypeError: Object of type ‘bytes’ is not JSON serializable
- Delete an element from a dictionary
- How to add multiple values per key in python dictionary
- Get key by value in dictionary
- How to add multiple values to a dictionary key in python?
- Python ValueError: No JSON object could be decoded
- How to POST JSON data with Python Requests?
- Determine the type of an object?
- Python error load JSON code of google API
- enumerate() for dictionary in python
- Return JSON response from Flask view
- Reverse / invert a dictionary mapping
- Creating 2D dictionary in Python
- How to overcome “datetime.datetime not JSON serializable”?
- How to print a dictionary’s key?
- Converting Dictionary to List?
- How to pretty print nested dictionaries?
- Displaying better error message than “No JSON object could be decoded”
- JSON to pandas DataFrame
- Convert a Pandas DataFrame to a dictionary
- How to index into a dictionary?
- Python error load JSON code of google API
- In Python, when to use a Dictionary, List or Set?
- Add a new item to a dictionary in Python
- How can I add new keys to a dictionary?
- Displaying better error message than “No JSON object could be decoded”
- TypeError: string indices must be integers, not str // working with dict
- How do I format a string using a dictionary in python-3.x?
- Converting XML to JSON using Python?
- Creating a dictionary from a csv file?
- Map to List error: Series object not callable
- How can I create an array/list of dictionaries in python?
- Comparing two dictionaries and checking how many (key, value) pairs are equal
- Mapping over values in a python dictionary
- TypeError: ‘dict_keys’ object does not support indexing
- What is the difference between json.load() and json.loads() functions
- NumPy array is not JSON serializable
- ValueError: Expected object or value when reading json as pandas dataframe
- How do I print the key-value pairs of a dictionary in python
- How do I print the key-value pairs of a dictionary in python
- How do I make a dictionary with multiple keys to one value?
- Python: How to check if keys exists and retrieve value from Dictionary in descending priority
- Appending values to dictionary in Python
- Python dictionary from an object’s fields
- Writing a dictionary to a csv file with one line for every ‘key: value’
- How to convert a file into a dictionary?
- Append a dictionary to a dictionary
- how to read json object in python
- convert csv file to list of dictionaries
- how to concatenate two dictionaries to create a new one in Python?
- TypeError: expected str, bytes or os.PathLike object, not _io.TextIOWrapper
- Change the name of a key in dictionary
- Loading and parsing a JSON file with multiple JSON objects
- What is an easy way to implement fprintf in python?
- How can I extract all values from a dictionary in Python?
- TypeError: the JSON object must be str, not ‘bytes’
- Create a list with initial capacity in Python
- Accessing dict_keys element by index in Python3
- Iterating over dictionary items(), values(), keys() in Python 3
- Flatten nested dictionaries, compressing keys
- python dictionary error AttributeError: ‘list’ object has no attribute ‘keys’
- How to get POSTed JSON in Flask?
- How to print both strings in a dictionary in Python