Your question is Deep Compare Nested JSON. 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.
How would you implement a custom deep-comparison function to validate two complex nested JSON API responses?
Implement deep_compare(response_a, response_b) for already parsed JSON values. Object key order must not matter, array order must matter, and values must be compared recursively. Return True only when both responses have the same structure and values, treating JSON numeric values such as 1 and 1.0 as equal. Example: {"a": 1, "b": [2]} and {"b": [2], "a": 1} return True; [1, 2] and [2, 1] return False.
def deep_compare(response_a, response_b):