JSONLogic Shiny JSON Logic

shiny_json_logic

The most compliant and fastest Ruby implementation of JSON Logic. 100% of official tests. Zero dependencies.

601/601 official tests
+117% faster than next gem
Ruby 2.4+ supported

Install

Add to your Gemfile:

Gemfile
gem 'shiny_json_logic'

Then run:

Terminal
$ bundle install

Usage

app.rb
require 'shiny_json_logic'

rule = { ">" => [{ "var" => "age" }, 18] }
data = { "age" => 21 }

ShinyJsonLogic.apply(rule, data)
# => true

# Aliases for easier migration from other gems
JsonLogic.apply(rule, data)   # => true
JSONLogic.apply(rule, data)   # => true

Try it live

Rule (JSON Logic) logic
Data (JSON) input
Ruby shiny_json_logic
Hit Evaluate to see the result
JavaScript json-logic-engine
Hit Evaluate to see the result

How does it compare?

Feature shiny_json_logic json_logic json-logic-rb json_logic_ruby
Official tests 100% 63.9% 93.68% 42.3%
Avg. ops/s 🏆 >100k ~55k ~40k ~45k
Last updated 2026 2020 2026 2024
Ruby 2.x
Ruby 3.x
Ruby 4.x
Handles truthiness correctly
Zero dependencies
Actively maintained

Why shiny_json_logic?

100% Spec Compliant

Passes all 601 official JSON Logic tests from the json-logic community. No edge cases swept under the rug.

Fastest Ruby Implementation

Wins all 18/18 Linux benchmark runs across every Ruby version tested, with margins of +9% to +117% faster. See benchmarks →

Zero Dependencies

No runtime dependencies. Lightweight, predictable, and easy to audit.

Ruby 2.4+ Support

Works on Ruby 2.4 through 4.0, including legacy Rails apps. Other gems require Ruby 3.0+.

Using PHP instead?

Shiny JSON Logic is also available for PHP — same spec compliance, same API.

shiny/json-logic-php →