Back to Validation

Json

docs/validators/Json.md

3.1.11.1 KB
Original Source
<!-- SPDX-License-Identifier: MIT SPDX-FileCopyrightText: (c) Respect Project Contributors SPDX-FileContributor: Alexandre Gomes Gaigalas <[email protected]> SPDX-FileContributor: Henrique Moody <[email protected]> -->

Json

  • Json()

Validates if the given input is a valid JSON.

php
v::json()->assert('{"foo":"bar"}');
// Validation passes successfully

Templates

Json::TEMPLATE_STANDARD

ModeTemplate
default{{subject}} must be a JSON string
inverted{{subject}} must not be a JSON string

Template placeholders

PlaceholderDescription
subjectThe validated input or the custom validator name (if specified).

Categorization

  • Strings

Changelog

VersionDescription
3.0.0Templates changed
0.3.9Created

See Also