Your question is Validate Nested JSON Configurations. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Given a JSON string representing a hierarchical model configuration, parse it and validate every nested object. Each node must contain a string field name, a string field type, an object field params, and an optional array field children. Return a list of validation errors using dot-paths such as children[1].params.lr. If the JSON is invalid, return [{"path": "$", "message": "invalid json"}].
def validate_model_config(payload):