Parse JSON file. Return parsed value, or None on any error.
(path)
| 500 | |
| 501 | |
| 502 | def load_json(path): |
| 503 | """Parse JSON file. Return parsed value, or None on any error.""" |
| 504 | if not path.is_file(): |
| 505 | return None |
| 506 | try: |
| 507 | with open(path, "r", encoding="utf-8") as f: |
| 508 | return json.load(f) |
| 509 | except (OSError, json.JSONDecodeError): |
| 510 | return None |
| 511 | |
| 512 | |
| 513 | def has_key(data, key): |
no test coverage detected