---
name: "Dancer::Serializer::JSON"
section: "3pm"
platform: "linux"
package: "libdancer-perl"
version: "1.3521+dfsg-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Dancer::Serializer::JSON"
---

# Dancer::Serializer::JSON(3pm)

serializer for handling JSON data

## NAME

Dancer::Serializer::JSON - serializer for handling JSON data

## VERSION

version 1.3521

## SYNOPSIS

## DESCRIPTION

This class is an interface between Dancer's serializer engine abstraction layer and the JSON module.

In order to use this engine, use the template setting:

```
    serializer: JSON
```

This can be done in your config.yml file or directly in your app code with the **set** keyword. This serializer will also be used when the serializer is set to **mutable** and the correct Accept headers are supplied.

The JSON module will pass configuration variables straight through. Some of these can be useful when debugging/developing your app: **pretty** and **canonical**, and others useful with ORMs like DBIx::Class: **allow\_blessed** and **convert\_blessed**.  Please consult the JSON documentation for more information and a full list of configuration settings. You can add extra settings to the **engines** configuration to turn these on. For example:

```
    engines:
        JSON:
            allow_blessed:   '1'
            canonical:       '1'
            convert_blessed: '1'
```

## METHODS

### serialize

Serialize a data structure to a JSON structure.

### deserialize

Deserialize a JSON structure to a data structure

### content\_type

Return 'application/json'

## AUTHOR

Dancer Core Developers

## COPYRIGHT AND LICENSE

This software is copyright (c) 2010 by Alexis Sukrieh.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
