Untitled
unknown
plain_text
a year ago
518 B
11
Indexable
# Helper func to decide if it is an JSON array type
def is_json_array_of_objects(data):
try:
# 1. Parse the JSON string (if needed)
if isinstance(data, str):
data = json.loads(data)
# 2. Check if it's a list
if not isinstance(data, list):
return False
# 3. Check if all elements are dictionaries
return all(isinstance(item, dict) for item in data)
except json.JSONDecodeError:
# Handle invalid JSON input
return False
Editor is loading...
Leave a Comment