| 1 | package Mojo::Autobox::Hash; | ||
| 2 | |||
| 3 | 4 | ▶ | use Mojo::Base -strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 2 | ▶ | sub json { |
|
Subroutine
json: called CC=1 SCAR=0.0
Pod
documented
| |||
| 6 | 2 | require Mojo::JSON; | |
| 7 | 2 | Mojo::JSON::encode_json(shift); | |
| 8 | } | ||
| 9 | |||
| 10 | 4 | *j = \&json; | |
| 11 | |||
| 12 | 4 | 1; | |
| 13 | |||
| 14 | =head1 NAME | ||
| 15 | |||
| 16 | Mojo::Autobox::Hash - Autobox hash methods for Mojo::Autobox | ||
| 17 | |||
| 18 | =head1 SYNOPSIS | ||
| 19 | |||
| 20 | use Mojo::Autobox; | ||
| 21 | |||
| 22 | # '{"hello": "world"}' | ||
| 23 | {hello => 'world'}->json; | ||
| 24 | |||
| 25 | =head1 DESCRIPTION | ||
| 26 | |||
| 27 | Hash methods for L<Mojo::Autobox>. These also apply to hash references. | ||
| 28 | |||
| 29 | =head1 METHODS | ||
| 30 | |||
| 31 | =head2 json | ||
| 32 | |||
| 33 | Serializes the invocant hash using L<Mojo::JSON/encode_json> and returns the result. | ||
| 34 | |||
| 35 | =head2 j | ||
| 36 | |||
| 37 | An alias for L</json>. | ||
| 38 | |||