{"id":21062,"library":"condense-json","title":"condense-json","description":"A Python library for condensing JSON objects by replacing long values with shorter replacement strings, useful for reducing payload size or token count. Version 0.1.3, stable but early stage; no set release cadence.","status":"active","version":"0.1.3","language":"python","source_language":"en","source_url":"https://github.com/simonw/condense-json","tags":["json","condense","replace","serialization"],"install":[{"cmd":"pip install condense-json","lang":"bash","label":"PyPI"}],"dependencies":[],"imports":[{"note":"Aliasing is unnecessary but not wrong; ensure correct function name.","wrong":"from condense_json import condense_json as condense","symbol":"condense_json","correct":"from condense_json import condense_json"},{"note":"","wrong":"","symbol":"uncondense_json","correct":"from condense_json import uncondense_json"}],"quickstart":{"code":"from condense_json import condense_json, uncondense_json\n\nobj = {\"name\": \"John Doe\", \"email\": \"john@example.com\", \"long_field\": \"a very long string that we want to replace\"}\nreplacements = {\"a very long string that we want to replace\": \"short\"}\ncondensed = condense_json(obj, replacements)\nprint(condensed)  # {\"name\": \"John Doe\", \"email\": \"john@example.com\", \"long_field\": \"short\"}\nrestored = uncondense_json(condensed, replacements)\nprint(restored)  # original obj","lang":"python","description":"Basic usage: condense JSON values using a replacements dict, then restore."},"warnings":[{"fix":"Update to >=0.1.2 or ensure replacements dict has no None values.","message":"If replacements dict contains None values, condense_json may raise KeyError. Ensure all replacement values are strings or non-None.","severity":"gotcha","affected_versions":"<=0.1.1"},{"fix":"Update to >=0.1.3 or avoid using empty strings as replacement keys.","message":"If a replacement key is an empty string, condense_json may raise KeyError on blank replacements.","severity":"gotcha","affected_versions":"<=0.1.2"},{"fix":"Ensure replacements are exact value strings, not substrings. Use recursive calls if needed.","message":"condense_json only replaces exact string matches; it does not recurse into nested objects' keys, only values.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Remove None values from replacements or upgrade to >=0.1.2.","cause":"Replacements dict contains None as a value, causing KeyError in versions <=0.1.1.","error":"KeyError: None"},{"fix":"Remove empty string keys from replacements or upgrade to >=0.1.3.","cause":"Replacements dict contains an empty string as a key, causing KeyError in versions <=0.1.2.","error":"KeyError: ''"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}