{"library":"jsondiff","code":"from jsondiff import diff, symbols\n\njson1 = {\n    \"name\": \"Alice\",\n    \"age\": 25,\n    \"city\": \"New York\",\n    \"hobbies\": [\"reading\", \"hiking\", \"coding\"]\n}\n\njson2 = {\n    \"name\": \"Bob\",\n    \"age\": 30,\n    \"city\": \"London\",\n    \"occupation\": \"Engineer\",\n    \"hobbies\": [\"reading\", \"running\", \"coding\"]\n}\n\n# Basic diff (compact syntax by default)\ncompact_diff = diff(json1, json2)\nprint(\"Compact Diff:\", compact_diff)\n\n# Explicit diff (more detailed output with symbols)\nexplicit_diff = diff(json1, json2, syntax='explicit')\nprint(\"\\nExplicit Diff:\", explicit_diff)\n\n# Accessing specific changes using symbols\nif symbols.insert in explicit_diff:\n    print(\"  Inserted keys:\", explicit_diff[symbols.insert])\nif symbols.delete in explicit_diff:\n    print(\"  Deleted keys:\", explicit_diff[symbols.delete])\nif symbols.update in explicit_diff:\n    print(\"  Updated keys:\", explicit_diff[symbols.update])\n","lang":"python","description":"This quickstart demonstrates how to use `jsondiff.diff` to compare two JSON objects. It shows both the default compact output and the more verbose 'explicit' syntax, which leverages `jsondiff.symbols` to clearly identify insertions, deletions, and updates within the JSON structures.","tag":null,"tag_description":null,"last_tested":"2026-04-24","results":[{"runtime":"python:3.10-alpine","exit_code":0},{"runtime":"python:3.10-slim","exit_code":0},{"runtime":"python:3.11-alpine","exit_code":0},{"runtime":"python:3.11-slim","exit_code":0},{"runtime":"python:3.12-alpine","exit_code":0},{"runtime":"python:3.12-slim","exit_code":0},{"runtime":"python:3.13-alpine","exit_code":0},{"runtime":"python:3.13-slim","exit_code":0},{"runtime":"python:3.9-alpine","exit_code":0},{"runtime":"python:3.9-slim","exit_code":0}]}