{"id":6689,"library":"json-logic-qubit","title":"JSON Logic Qubit Python Parser","description":"json-logic-qubit is a Python parser that accepts JsonLogic rules and executes them. It is a port of the JavaScript json-logic-js project, designed to allow sharing rules (logic) between front-end and back-end code, and for storing logic in databases. The current version is 0.9.1. The project appears to be in maintenance mode with infrequent updates.","status":"maintenance","version":"0.9.1","language":"en","source_language":"en","source_url":"https://github.com/qubitproducts/json-logic-py","tags":["json","logic","rules","dsl","expression-language","business-rules"],"install":[{"cmd":"pip install json-logic-qubit","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"note":"The primary function `jsonLogic` is exposed directly from the `json_logic` sub-package, not the top-level `json_logic_qubit`.","wrong":"from json_logic_qubit import jsonLogic","symbol":"jsonLogic","correct":"from json_logic import jsonLogic"}],"quickstart":{"code":"from json_logic import jsonLogic\n\n# Simple rule: 1 == 1\nresult1 = jsonLogic({ \"==\" : [1, 1] })\nprint(f\"Simple rule (1 == 1): {result1}\")\n\n# Data-driven rule: check if 'temp' < 110 AND 'pie.filling' == 'apple'\nrules = {\n    \"and\" : [\n        { \"<\" : [ { \"var\" : \"temp\" }, 110 ] },\n        { \"==\" : [ { \"var\" : \"pie.filling\" }, \"apple\" ] }\n    ]\n}\ndata = { \"temp\" : 100, \"pie\" : { \"filling\" : \"apple\" } }\n\nresult2 = jsonLogic(rules, data)\nprint(f\"Complex rule (pie ready): {result2}\")","lang":"python","description":"This quickstart demonstrates how to import and use the `jsonLogic` function with both a simple comparison rule and a more complex, data-driven rule that checks nested properties."},"warnings":[{"fix":"Thoroughly test with your specific Python environment and consider alternative actively maintained JsonLogic implementations if long-term support or cutting-edge features are required.","message":"The json-logic-qubit library has not been updated since August 2018. While functional, it may lack compatibility with newer Python versions or not include features/bug fixes from the broader JsonLogic ecosystem. Related projects by 'QubitProducts' have been archived.","severity":"deprecated","affected_versions":"<=0.9.1"},{"fix":"Always use `pip install json-logic-qubit` to ensure you get this fork, which was created to address maintenance issues of the original `json-logic` package. Verify your `from json_logic import jsonLogic` import works as expected.","message":"An older, less maintained Python package named `json-logic` exists on PyPI. Installing it by mistake can lead to an outdated and buggy implementation of the JsonLogic specification.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Test your rules and data extensively on your target Python version. Inspect error messages for issues related to dictionary views or iteration changes in newer Python versions.","message":"Older versions of a base `json-logic` library (from which this project is forked) experienced `TypeError: 'dict_keys' object does not support indexing` with Python 3.6+. While potentially fixed in this fork, due to the project's age, unforeseen compatibility issues with modern Python versions (3.7+) may arise.","severity":"gotcha","affected_versions":"Potentially Python 3.6+"},{"fix":"Rigorously test rules that involve `var` operators with boolean `False` values to ensure the expected output. Consider explicit comparisons like `{\"==\": [{\"var\": \"key\"}, false]}` if ambiguity arises.","message":"Some JsonLogic implementations (in other languages) have had a known issue where the `{\"var\": \"key\"}` operator returns `None` instead of `False` when the referenced data value is literally `False`. This can break logic relying on explicit boolean `False` checks.","severity":"gotcha","affected_versions":"Potentially all versions"}],"env_vars":null,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z","problems":[]}