Skip to content

LIVRLanguage Independent Validation Rules

Describe valid data once, as a declarative schema. Get the same validation, the same output and the same error codes in JavaScript, Perl, PHP, Python, Go, Erlang and more.

rules

{
  name:    'required',
  email:   ['required', 'email'],
  age:     ['positive_integer', { min_number: 18 }],
  address: { nested_object: {
    city: 'required',
    zip:  'positive_integer'
  }}
}

input

{
  email: 'john@', age: 16, role: 'admin',
  address: { city: 'Kyiv', zip: 'O1001' }
}

errors Invalid

{
  "name": "REQUIRED",
  "email": "WRONG_EMAIL",
  "age": "TOO_LOW",
  "address": {
    "zip": "NOT_POSITIVE_INTEGER"
  }
}

Try it right here ​

Edit the rules or the input. The result is computed live in your browser by the JavaScript implementation, and every other implementation returns exactly the same.

Live example · edit rules or inputOpen in playground
rules
input
Validoutput
{
  "name": "John",
  "email": "john@example.com",
  "gender": "male",
  "password": "mypassword1",
  "password2": "mypassword1"
}

More examples →