{"id":23449,"library":"compress-json","title":"compress-json","description":"The missing Python utility to read and write large compressed JSONs. Supports automatic compression detection from file extensions (gzip, bz2, lzma, xz) or explicit specification. Current version 1.1.1, active development with periodic releases.","status":"active","version":"1.1.1","language":"python","source_language":"en","source_url":"https://github.com/LucaCappelletti94/compress_json","tags":["json","compression","serialization","gzip","bz2","lzma","xz"],"install":[{"cmd":"pip install compress-json","lang":"bash","label":"Install via pip"}],"dependencies":[],"imports":[{"note":"compress_json is the package name, not a module; use dump/load directly","wrong":"from compress_json import compress_json","symbol":"dump","correct":"from compress_json import dump"},{"note":"","wrong":null,"symbol":"load","correct":"from compress_json import load"}],"quickstart":{"code":"from compress_json import dump, load\n\ndata = {\"key\": \"value\"}\n# Save to file (extension determines compression)\ndump(data, \"data.json.gz\")\n# Load back\nloaded = load(\"data.json.gz\")\nprint(loaded)","lang":"python","description":"Basic usage: dump serializes to a compressed JSON file, load reads it back. Compression type is inferred from file extension (.gz, .bz2, .xz, .lzma)."},"warnings":[{"fix":"Always provide data first, then file path.","message":"Argument order: dump(data, path) not dump(path, data). Swapping arguments raises ValueError: 'Expected a dictionary or list, got str'.","severity":"gotcha","affected_versions":">=1.0.5"},{"fix":"Use compression='gzip' (or 'bz2', 'lzma', 'xz') when extension is missing or does not match.","message":"File extension must match actual compression or pass compression argument explicitly; otherwise, function may misinterpret format.","severity":"gotcha","affected_versions":">=1.1.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Swap arguments: from_compress_json import dump; dump(my_data, 'file.json.gz')","cause":"Calling dump(path, data) instead of dump(data, path).","error":"Expected a dictionary or list, got str"},{"fix":"Add compression='lzma' (or other) to dump/load, or use a standard extension (.gz, .bz2, .xz, .lzma).","cause":"Using an uncommon extension like .json.lz or no extension without specifying compression parameter.","error":"ValueError: Unsupported file extension"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}