Last active
November 29, 2018 11:37
-
-
Save phpfour/cc959c7d62cf0093850577f6ee6ec9f3 to your computer and use it in GitHub Desktop.
JMS Serializer Options
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| use JMS\Serializer\SerializerBuilder; | |
| use JMS\Serializer\JsonSerializationVisitor; | |
| use JMS\Serializer\Naming\IdenticalPropertyNamingStrategy; | |
| use JMS\Serializer\Naming\SerializedNameAnnotationStrategy; | |
| $visitor = new JsonSerializationVisitor( | |
| new SerializedNameAnnotationStrategy( | |
| new IdenticalPropertyNamingStrategy() | |
| ) | |
| ); | |
| $visitor->setOptions(JSON_UNESCAPED_SLASHES); | |
| $serializer = SerializerBuilder::create() | |
| ->setSerializationVisitor('json', $visitor) | |
| ->build(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment