wiki/content/20201112125637-symfony_json_constraint.md

23 lines
335 B
Markdown
Raw Normal View History

2024-05-06 20:40:05 +00:00
---
2024-10-30 17:34:11 +00:00
date: 2020-11-12
2024-05-06 20:40:05 +00:00
id: 4e20e5e5-06b6-4280-9cd0-7b08585a762b
title: Symfony JSON Constraint
---
# Syntax
``` php
// 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;
}
```