wiki/content/20201112125637-symfony_json_constraint.md

333 B

date id title
20201112 4e20e5e5-06b6-4280-9cd0-7b08585a762b Symfony JSON Constraint

Syntax

// src/Entity/Book.php
namespace App\Entity;

use Symfony\Component\Validator\Constraints as Assert;

class Book
{
    /**
     * @Assert\Json(message = "This is not valid JSON")
     */
     protected $chapters;
}