NAME

Test::HTTP::Scenario::Serializer::JSON - JSON serializer for Test::HTTP::Scenario

SYNOPSIS

use Test::HTTP::Scenario::Serializer::JSON;

my $ser = Test::HTTP::Scenario::Serializer::JSON->new;
my $json = $ser->encode_scenario(\%data);
my $data = $ser->decode_scenario($json);

DESCRIPTION

This module provides JSON based serialization for Test::HTTP::Scenario. It uses JSON::MaybeXS with canonical output so that fixture files are deterministic.

METHODS

new

Constructs a new serializer object.

encode_scenario

Takes a hashref representing a scenario and returns a JSON string.

decode_scenario

Takes a JSON string and returns a hashref representing a scenario.

NOTES

This module assumes that scenario data structures contain only simple scalars, arrays and hashes.