@pythonlearner1 - yes type will tell you just that, the type of the "data", but that will not tell you if the contents of the data is valid (and hence my suggestion to use a json validator if unsure first), in the case of the original posting, the variables the developer used can be tested as you say, but when the json he is reading is dumped into that variable it will just tell him the variable is of type "dict" or "list" or "str" for example, it wont tell him that the json is valid json necessarily, or that its presentation is without escape characters (encoding) depending on the method chosen or the package used - (there are a plethora of json parsers and validator packages in python), also the user was trying to iterate over a list in his second piece of code using a "dictionary" style "keywords", whereas a List requires indexes or an index range for splicing.
Regards
-------- *
“Outside of a dog, a book is man's best friend. Inside of a dog it's too dark to read.”
-------- *
“Outside of a dog, a book is man's best friend. Inside of a dog it's too dark to read.”