Skip to content
Zotonic
  • Start
  • Cookbook
  • Reference
  • Releases

Live search

Search across all Zotonic content

Type at least two characters

Results are matched against titles, summaries and topics as you type.

Validators · mod_base
  • Reference
  • Frontend developer
  • Template validator
  • Validate
  • JSON

json

Module

mod_base

Validate that a form value is JSON.

Whitespace is trimmed before decoding. An empty value is accepted; combine the validator with presence when the field is required. A valid value is returned unchanged apart from surrounding whitespace.

For example:

<textarea id="settings" name="settings"></textarea>
{% validate id="settings" type={json} %}

Edit on GitHub

presence Validators acceptable_password

Related documentation

Validators

page_path_unique

A validator to check whether a resource’s page path is unique:

Validators

hasedge

A validator to check if a resource has a certain number of edges with a predicate.

Validators

acceptable_password

A validator to check whether a password conforms to the password secutiry requirements.

Validators

numericality

Numerical input and range check.

Validators

name_unique

A validator to check whether a resource’s name is unique:

Validators

format

Regular expression test.

Validators

length

Check the length of a text input.

Validators

date

Validate input date against a given date format.

Validators

presence

Check if an input has been filled in or checked.

GitHub © 2026 Zotonic