from json_parser import JsonParser result = JsonParser(data, ["first_name", "street", "address*"]).get_data() CODE_BLOCK: from json_parser import JsonParser result = JsonParser(data, ["first_name", "street", "address*"]).get_data() CODE_BLOCK: from json_parser import JsonParser result = JsonParser(data, ["first_name", "street", "address*"]).get_data() COMMAND_BLOCK: from jsonpath_ng import parse first_names = parse('$..first_name').find(data) streets = parse('$..street').find(data) addresses = parse('$..address*').find(data) # Note: * works but not exactly the same COMMAND_BLOCK: from jsonpath_ng import parse first_names = parse('$..first_name').find(data) streets = parse('$..street').find(data) addresses = parse('$..address*').find(data) # Note: * works but not exactly the same COMMAND_BLOCK: from jsonpath_ng import parse first_names = parse('$..first_name').find(data) streets = parse('$..street').find(data) addresses = parse('$..address*').find(data) # Note: * works but not exactly the same COMMAND_BLOCK: pip install json-key-parser COMMAND_BLOCK: pip install json-key-parser COMMAND_BLOCK: pip install json-key-parser
- JSON structure is unpredictable or changes often (third-party APIs, logs, scraped data)
- You just want a flat dict/list of the fields you care about
- Duplicate keys appear at different nesting levels (it merges them intelligently)
- You hate writing defensive data.get("a", {}).get("b", []) chains
- You need filters: $.books[?(@.price > 20)]
- You want to update or delete values in place: expr.update(data, new_value)
- You need arithmetic, regex, slicing, or parent references
- You’re doing metaprogramming (it exposes a clean AST)
- You want full paths back: match.full_path - json-key-parser: pure stdlib, < 50 KB installed - jsonpath-ng: robust parser (no longer pulls in ply at runtime in recent versions), still tiny - jsonpath-ng is mature, heavily tested, and used in production everywhere. - json-key-parser is brand new (Beta status) but laser-focused, so its recursion is extremely fast for the 95% use case.
- You’re writing ETL scripts, API clients, or data-cleaning notebooks
- Your JSON is messy and you just want “first_name, email, total” regardless of nesting
- You value readability and minimal code
- You need conditional filtering or data transformation
- You’re building a library or tool that requires precise, repeatable queries
- You want to modify the JSON structure in place