jsonlogic-validator

Implement, validate, and test JSONLogic rules for portable business logic.

Updated Feb 21, 2026
One-click install
npx skills add https://github.com/joySUSY/violet-plugin-place --skill jsonlogic-validator-joysusy
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: jsonlogic-validator
Source: https://github.com/joySUSY/violet-plugin-place/tree/main/plugins/js-dev-skill/v3-expansion
Command: npx skills add https://github.com/joySUSY/violet-plugin-place --skill jsonlogic-validator-joysusy

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires json-logic-js, and includes scripts (resource) and references (resource) components.

What problem does it solve? Writing business rules as JSONLogic is error-prone: misspelled operators, wrong argument counts, and mismatched data paths cause silent failures. This Skill helps you write correct JSONLogic rules, validate their syntax and semantics, and test them against sample data before deployment. ## Core Features & Use Cases - Rule Authoring Guidance: Step-by-step workflow for converting business requirements into JSONLogic, with common patterns like range checks, tier classification, and array operations. - Syntax & Semantic Validation: A dependency-free Node.js script checks operator spelling, argument arity, and data path existence against sample data. - Test Case Execution: Run rules against multiple test cases with expected outputs using the json-logic-js library. - Use Case: You need a discount rule where premium users over 25 get 20% off. Write the rule, validate it with the script, then run test cases with different ages and tiers to confirm correct behavior. ## Quick Start Ask the assistant to write and validate a JSONLogic rule for your business condition, then test it against sample data.

Frequently Asked Questions about jsonlogic-validator

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I validate a JSONLogic rule before deploying it?▼

Run the validate-jsonlogic.js script with your rule as an argument: node scripts/validate-jsonlogic.js '<rule>'. It checks operator spelling, argument counts, and structure without requiring any npm dependencies. Optionally pass sample data to verify that all var paths exist.

How do I test JSONLogic rules against sample data?▼

Install json-logic-js via npm, then run test-jsonlogic.js with your rule and a JSON array of test cases containing data and expected values. The script reports pass or fail for each case with expected versus actual results.

What operators does JSONLogic support?▼

JSONLogic supports data access (var, missing), logic (if, and, or, comparison operators), numeric operations (arithmetic, min, max), array operations (map, filter, reduce, all, some, none), and string operations (cat, substr, in). The full reference is in references/jsonlogic-reference.md.

Does JSONLogic truthiness work the same as JavaScript?▼

No. JSONLogic treats empty arrays as falsy and the string "0" as truthy, which differs from JavaScript. Falsy values are 0, empty array, empty string, and null; everything else is truthy.

Why does my JSONLogic rule fail with an unknown operator error?▼

The operator name is likely misspelled or is a custom operation not registered with the validator. Check spelling against the valid operator list, or pass custom operators via the --custom-ops flag when validating.

Can JSONLogic rules be shared between frontend and backend?▼

Yes. JSONLogic rules are plain JSON, so they can be stored in databases and executed by implementations in JavaScript, Python, PHP, Ruby, Go, Java, .Net, and C++. Rules are deterministic with no eval or side effects.