#!/usr/bin/perl use strict; use warnings; use feature("say"); use Data::Dumper::Simple; use HTTP::Request::JSON; my $perl_structure = { 'sub' => { 'name' => 'foo', 'message' => 'bar' }, 'name' => 'test name', 'file_ids' => [ 1, 2 ] }; my $request = HTTP::Request::JSON->new; $request->json_content($perl_structure); say $request->decoded_content; say Dumper $request; #### {"file_ids":[1,2],"name":"test name","sub":{"message":"bar","name":"foo"}} $request = bless( { '_content' => '{"file_ids":[1,2],"name":"test name","sub":{"message":"bar","name":"foo"}}', '_uri' => undef, '_headers' => bless( { 'content-type' => 'application/json', 'accept' => 'application/json' }, 'HTTP::Headers' ), '_method' => undef }, 'HTTP::Request::JSON' );