I am looking for different ways to check values within JSON.
For instance, to check that the value is:
- int -
isinstance(value, int) - String -
isinstance(value, str) - Array -
isinstance(value, list)
But what is the cleanest way to check if values are list, dict or a list of dictionaries? How to correctly differentiate between them?
Example
{
"test": ["a","b"]
}
vs
{
"test": {"a":0, "b":1}
}
vs
{
"test": [
{"a":0},
{"b":1}
]
}