RulesJson — Convert Laravel Validation Rules to a JSON Request Body Instantly

Published: (April 25, 2026 at 12:52 AM EDT)
1 min read
Source: Dev.to

Source: Dev.to

Cover image for RulesJson — Convert Laravel Validation Rules to a JSON Request Body Instantly

Overview

Every Laravel developer has been there: you finish writing a FormRequest, switch to your API client, and spend the next few minutes manually reconstructing the JSON body to test it. RulesJson eliminates that step entirely.

Paste your $rules array in any format — pipe strings, PHP associative arrays, Laravel array rules, or plain JS objects — and get a fully populated, syntax‑highlighted JSON body instantly. Fields are name‑aware, so email fields get real email addresses, UUID fields get valid UUIDs, slug fields get slugs, and in: rules pick the first valid enum value automatically. Dot‑notation fields like address.city produce properly nested objects. Wildcard arrays like tags.* produce typed single‑item arrays. The confirmed rule auto‑generates the _confirmation sibling. Nullable fields without an explicit type resolve to null.

Built with vanilla JS and Tailwind CSS. Zero dependencies. Everything runs in the browser — no data is ever sent anywhere. MIT licensed and open to contributions.

Try it live

🌐

Source code

📦

0 views
Back to Blog

Related posts

Read more »