---
name: "DBIx::Class::InflateColumn::Serializer::JSON"
section: "3pm"
platform: "linux"
package: "libdbix-class-inflatecolumn-serializer-perl"
version: "0.09-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/DBIx::Class::InflateColumn::Serializer::JSON"
---

# DBIx::Class::InflateColumn::Serializer::JSON(3pm)

JSON Inflator

## NAME

DBIx::Class::InflateColumn::Serializer::JSON - JSON Inflator

## SYNOPSIS

```
  package MySchema::Table;
  use base 'DBIx::Class';
  __PACKAGE__->load_components('InflateColumn::Serializer', 'Core');
  __PACKAGE__->add_columns(
    'data_column' => {
      'data_type' => 'VARCHAR',
      'size'      => 255,
      'serializer_class'   => 'JSON',
      'serializer_options' => { allow_blessed => 1, convert_blessed => 1, pretty => 1 },    # optional
    }
  );
```

Then in your code...

```
  my $struct = { 'I' => { 'am' => 'a struct' };
  $obj->data_column($struct);
  $obj->update;
```

And you can recover your data structure with:

```
  my $obj = ...->find(...);
  my $struct = $obj->data_column;
```

The data structures you assign to "data\_column" will be saved in the database in JSON format.

Any arguments included in `"serializer_options"` will be passed to the JSON::MaybeXS constructor, to be used by the JSON backend for both serializing and deserializing.

- get\_freezer

  Called by DBIx::Class::InflateColumn::Serializer to get the routine that serializes the data passed to it. Returns a coderef.

- get\_unfreezer

  Called by DBIx::Class::InflateColumn::Serializer to get the routine that deserializes the data stored in the column. Returns a coderef.
