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;
}