JSON is arguably the most used format in applications developed with Symfony. You probably make requests to JSON APIs and send/receive JSON payloads in your projects. That's why Symfony provides a JsonResponse class, a way to build JSON authentication, full JSON support in the Serializer component, a json() helper for controllers, etc.
In Symfony 4.3 we improved the Validator component to add a new Json constraint, which can be applied to properties and getters, and ensures that the given contents are valid JSON contents:
1 2 3 4 5 6 7 8 9 10 11 12
// 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;
}
Amazing news!
Terrific !!
Thank you
Good news !!
Good news !! Thanks
Well done,
Finally :-) ! Thank you !
Need more complete work with json in Request object. example:
vs
Sounds Great. Well done.
Finally. Thank you!
What do You think about adding json schema validation?