{"library":"srsly","code":"import srsly\nimport os\n\n# Example with JSON\nfile_path = 'example.json'\ndata = {\"name\": \"Alice\", \"age\": 30, \"isStudent\": False}\n\n# Write JSON to a file\nsrsly.write_json(file_path, data)\nprint(f\"Data written to {file_path}\")\n\n# Read JSON from a file\nread_data = srsly.read_json(file_path)\nprint(f\"Data read from {file_path}: {read_data}\")\n\n# Clean up\nos.remove(file_path)\n\n# Example with JSONL (newline-delimited JSON)\njsonl_path = 'example.jsonl'\nlines = [{\"id\": 1, \"text\": \"First line\"}, {\"id\": 2, \"text\": \"Second line\"}]\n\n# Write JSONL to a file\nsrsly.write_jsonl(jsonl_path, lines)\nprint(f\"Data written to {jsonl_path}\")\n\n# Read JSONL from a file\nread_lines = list(srsly.read_jsonl(jsonl_path))\nprint(f\"Data read from {jsonl_path}: {read_lines}\")\n\n# Clean up\nos.remove(jsonl_path)","lang":"python","description":"This quickstart demonstrates how to use `srsly` to write and read data in JSON and JSONL formats. It covers basic file operations using `srsly.write_json`, `srsly.read_json`, `srsly.write_jsonl`, and `srsly.read_jsonl`.","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}]}