---
name: "KiokuDB::Backend::Serialize::JSON"
section: "3pm"
platform: "linux"
package: "libkiokudb-perl"
version: "0.57-3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/KiokuDB::Backend::Serialize::JSON"
---

# KiokuDB::Backend::Serialize::JSON(3pm)

Role to serialize entries to JSON strings with KiokuDB::Backend::Serialize::JSPON semantics

## NAME

KiokuDB::Backend::Serialize::JSON - Role to serialize entries to JSON strings with KiokuDB::Backend::Serialize::JSPON semantics

## VERSION

version 0.57

## SYNOPSIS

```
    with qw(KiokuDB::Backend::Serialize::JSON);
    sub foo {
        my ( $self, $entry ) = @_;
        my $json_string = $self->serialize($entry);
    }
```

## DESCRIPTION

This role provides additional convenience attributes and methods for backends that encode entries to JSON strings, on top of KiokuDB::Backend::Serialize::JSPON which only restructures the data.

KiokuDB::Backend::Serialize::Delegate is preferred to using this directly.

## METHODS

- serialize $entry

  Returns a JSON string

- deserialize $json\_str

  Returns a KiokuDB::Entry

## ATTRIBUTES

- json

  The JSON instance used to encode/decode the JSON.

- pretty

  Whether or not to pass the `"pretty"` flag to the JSON object after construction.

## AUTHOR

Yuval Kogman \<nothingmuch@woobling.org\>

## COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Yuval Kogman, Infinity Interactive.

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