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.
pip install json-logic-qubitVerified import paths — ran on the pinned version, not inferred.
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.
Thoroughly test with your specific Python environment and consider alternative actively maintained JsonLogic implementations if long-term support or cutting-edge features are required.
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.
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.
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.Change the import statement from `from json_logic_qubit import jsonLogic` (or similar) to `from json_logic import jsonLogic`.
Ensure you are using `json-logic-qubit` version 0.9.1. This version should include Python 3 compatibility fixes for how dictionary keys are accessed.
Verify that your JsonLogic rule strictly adheres to the JsonLogic specification (e.g., each rule is a dictionary with a single operator key and an array of arguments) and only uses operators supported by the `json-logic-qubit` library.
No dependency data recorded yet.