Skip to main content

Advanced Workflow Logic (JSON Rules Reference)

Reference guide for using JSON logic in workflow routing rules.

Lauren Baird avatar
Written by Lauren Baird
Updated over a month ago

Primary Role: Workflow Manager (Advanced)
Learning Focus: Reference
Where: Workflow Editor (Rule Configuration)


When to Use This

This article is a reference to be used when:

  • You need more complex logic than the visual Rule Builder supports

  • You are reviewing or troubleshooting an existing JSON rule

  • You are working with multi-select, checklist, or nested conditions

If you are new to routing, start with Configuring Rule-Based Routes.


When to Use JSON Logic for Complex Route Rules

Use JSON logic when:

  • Multiple conditions must be evaluated together

  • Checklist or multi-select responses drive routing

  • Visual Rule Builder options are insufficient

Avoid JSON logic when:

  • A simple Match / Any / All rule will work

  • The logic becomes hard to explain or maintain


Common Pitfalls

  • Typos or mismatched question labels

  • Incorrect nesting of operators

  • Using JSON logic where a simple rule would suffice

If a rule is hard to read, it’s usually too complex.


JSON Logic Basics

Each rule follows this general structure:

{ "operator": [ value1, value2 ] }

Referencing User Responses

To reference a user’s answer, use the exact question label:

{ "var": "Question Text" }

⚠️ Question labels are case-sensitive and must match exactly.


Common Operators

Equals

{ "==": [ { "var": "response" }, "Yes" ] }

Not Equal

{ "!=": [ { "var": "response" }, "No" ] }

NOT (Negation)

{ "!": { "var": "response" } }

IN (Used for Checklists / Multi-Select)

{ "in": [ "Eye Protection", { "var": "response" } ] }

AND

{   "and": [     { "==": [ { "var": "response" }, "Yes" ] },     { "==": [ { "var": "Supervisor Present" }, "No" ] }   ] }

OR

{   "or": [     { "in": [ "Eye Protection", { "var": "response" } ] },     { "in": [ "Face Shields", { "var": "response" } ] }   ] }

Nested Logic (Advanced)

Operators can be nested for more complex conditions:

{   "and": [     {       "or": [         { "in": [ "Eye Protection", { "var": "response" } ] },         { "in": [ "Face Shields", { "var": "response" } ] }       ]     },     { "==": [ { "var": "Work Area" }, "Shop Floor" ] }   ] }

Key Takeaways

  • JSON logic enables advanced routing scenarios

  • Question labels must match exactly

  • Keep logic as simple as possible

  • Always test rule behavior in a Demonstration (UAT) site

Did this answer your question?