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

php dev.to

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 named-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: https://rules-json.msaied.com
📦 GitHub: https://github.com/EG-Mohamed/RulesJson
👤 By Mohamed Said: https://msaied.com

Source: dev.to

arrow_back Back to Tutorials