Versionen

Inhaltsverzeichnis

Support

Sie können Support über die Symfony2 mailing list erhalten.

Falls Sie einen Bug gefunden haben, öffnen Sie bitte ein neues Ticket im Bug-Tracker.


Benötigen Sie einen Experten?

Nutzen Sie das Wissen und die Expertise eines Symfony2 Experten direkt vor Ort.
http://jmsyst.com/unterstuetzung

GitHub

JMSSerializerBundle

Introduction

JMSSerializerBundle allows you to serialize your data into a requested output format such as JSON, XML, or YAML, and vice versa.

You can learn more in the documentation for the standalone library.

Installation

You can install this bundle using composer

composer require jms/serializer-bundle

or add the package to your composer.json file directly.

After you have installed the package, you just need to add the bundle to your AppKernel.php file:

// in AppKernel::registerBundles()
$bundles = array(
    // ...
    new JMS\SerializerBundle\JMSSerializerBundle(),
    // ...
);

Configuration

JMSSerializerBundle requires no initial configuration to get you started.

For all available configuration options, please see the configuration reference.

Usage

The configured serializer is available as jms_serializer service:

$serializer = $container->get('jms_serializer');
$serializer->serialize($data, $format);
$data = $serializer->deserialize($inputStr, $typeName, $format);

In templates, you may also use the serialize filter:

{{ data | serialize }} {# serializes to JSON #}
{{ data | serialize('json') }}
{{ data | serialize('xml') }}

Learn more in the documentation for the dedicated library.

License

The code is released under the business-friendly Apache2 license.

Documentation is subject to the Attribution-NonCommercial-NoDerivs 3.0 Unported license.