KhaledMaged KhaledMaged - 8 months ago 39
JSON Question

What is the type of a JSON object in python?

I'm new to JSON. I have a dictionary, I convert it to a JSON object using

myJsonObject = json.dumps(myDictionary)

But then If I check the type, I get
<type 'str'>

Is string is the expected output for a JSON object?

PS: Python 2.7

Update: How can I get a JSON type, if dumps is not the correct way?


Of course, this is called "Serialization" - you are dumping a Python data structure into a JSON formatted string:


Serialize obj to a JSON formatted str using this conversion table.

If you load a JSON string with loads(), this would be "deserialization" and you would get a Python list or a dictionary.