Usage ===== Serializing Objects ------------------- Most common usage is probably to serialize objects. This can be achieved very easily: .. configuration-block :: .. code-block :: php <?php $serializer = JMS\Serializer\SerializerBuilder::create()->build(); $serializer->serialize($object, 'json'); $serializer->serialize($object, 'xml'); $serializer->serialize($object, 'yml'); .. code-block :: jinja {{ 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. .. code-block :: php <?php $serializer = JMS\Serializer\SerializerBuilder::create()->build(); $object = $serializer->deserialize($jsonData, 'MyNamespace\MyObject', 'json');
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
cookbook | Folder | 0755 |
|
|
reference | Folder | 0755 |
|
|
LICENSE | File | 15.76 KB | 0644 |
|
configuration.rst | File | 4.24 KB | 0644 |
|
cookbook.rst | File | 65 B | 0644 |
|
event_system.rst | File | 2.91 KB | 0644 |
|
handlers.rst | File | 1.98 KB | 0644 |
|
index.rst | File | 1.8 KB | 0644 |
|
reference.rst | File | 86 B | 0644 |
|
usage.rst | File | 1017 B | 0644 |
|