PHP code example of justblackbird / jms-serializer-strict-json

1. Go to this page and download the library: Download justblackbird/jms-serializer-strict-json library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

justblackbird / jms-serializer-strict-json example snippets


use JMS\Serializer\SerializerBuilder;

$serializer = SerializerBuilder::create()->build();

use JMS\Serializer\Naming\CamelCaseNamingStrategy;
use JMS\Serializer\Naming\SerializedNameAnnotationStrategy;
use JMS\Serializer\SerializerBuilder;
use JustBlackBird\JmsSerializerStrictJson\StrictJsonDeserializationVisitor;

$naming_strategy = new SerializedNameAnnotationStrategy(new CamelCaseNamingStrategy());
$serializer = SerializerBuilder::create()
    ->setPropertyNamingStrategy($naming_strategy)
    ->setDeserializationVisitor('json', new StrictJsonDeserializationVisitor($naming_strategy))
    ->build();