Versions

Table Of Contents

Support

You can obtain free community support for example through stackoverflow.

If you think you found a bug, please create a ticket in the bug tracker.


Continuous Inspections

If you take code quality seriously, try out the new continuous inspection service.
scrutinizer-ci.com

GitHub

Usage

Serializing Objects

Most common usage is probably to serialize objects. This can be achieved very easily:

<?php

$serializer = JMS\Serializer\SerializerBuilder::create()->build();
$serializer->serialize($object, 'json');
$serializer->serialize($object, 'xml');
$serializer->serialize($object, 'yml');
{{ object | serialize }} {# uses JSON #}
{{ object | serialize('json') }}
{{ object | serialize('xml') }}
{{ object | serialize('yml') }}

Deserializing Objects

You can also deserialize objects from their XML, or JSON representation. For example, when accepting data via an API.

<?php

$serializer = JMS\Serializer\SerializerBuilder::create()->build();
$object = $serializer->deserialize($jsonData, 'MyNamespace\MyObject', 'json');