Your question is Compare Two JSON Structures. 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.
OpenX services exchange nested JSON payloads for configuration and ad-serving workflows. Implement a function that returns True when two JSON-compatible Python values represent the same structure and values, and False otherwise.
Object key order must not matter. Array order must matter, and arrays must contain the same values in the same positions. JSON numbers are compared by numeric value, so 1 and 1.0 are considered equal. Do not serialize the inputs to compare them.
Implement compare_json(a, b):
a and b, each a valid JSON-compatible Python value: None, bool, int, float, str, list, or dict with string keys.def compare_json(a, b):