Aion-Format
view release on metacpan or search on metacpan
},
"runtime" : {
"recommends" : {
"Devel::Size" : "0"
},
"requires" : {
"DDP" : "0",
"Encode" : "0",
"Exporter" : "0",
"Guard" : "0",
"JSON::XS" : "0",
"List::Util" : "0",
"POSIX" : "0",
"Term::ANSIColor" : "0",
"YAML::Syck" : "0",
"bigint" : "0",
"bytes" : "0",
"common::sense" : "0",
"config" : "0",
"constant" : "0",
"perl" : "v5.22.0"
"url" : "https://github.com/darviarush/perl-aion-format.git",
"web" : "https://github.com/darviarush/perl-aion-format"
}
},
"version" : "0.1.2",
"x_authority" : "cpan:DART",
"x_contributors" : [
"Yaroslav O. Kosmina <dart@cpan.org>",
"Yaroslav O. Kosmina <darviarush@mail.ru>"
],
"x_serialization_backend" : "JSON::PP version 4.16",
"x_static_install" : 0
}
file: lib/Aion/Format/Url.pm
Aion::Format::Yaml:
file: lib/Aion/Format/Yaml.pm
recommends:
Devel::Size: '0'
requires:
DDP: '0'
Encode: '0'
Exporter: '0'
Guard: '0'
JSON::XS: '0'
List::Util: '0'
POSIX: '0'
Term::ANSIColor: '0'
YAML::Syck: '0'
bigint: '0'
bytes: '0'
common::sense: '0'
config: '0'
constant: '0'
perl: v5.22.0
requires 'open';
};
# ÐÐ»Ñ DDP
recommends 'Devel::Size';
requires 'DDP';
requires 'Guard';
requires 'Encode';
requires 'Exporter';
requires 'JSON::XS';
requires 'List::Util';
requires 'POSIX';
requires 'Term::ANSIColor';
requires 'YAML::Syck';
requires 'bigint';
requires 'bytes';
requires 'common::sense';
requires 'config';
requires 'constant';
i18n/Aion/Format/Json.ru-en.po view on Meta::CPAN
msgid "Aion::Format::Json - ÑаÑÑиÑение Perl Ð´Ð»Ñ ÑоÑмаÑиÑÐ¾Ð²Ð°Ð½Ð¸Ñ JSON"
msgstr "Aion::Format::Json - Perl extension for JSON formatting"
msgid "`Aion::Format::Json` иÑполÑзÑÐµÑ Ð² каÑеÑÑве оÑÐ½Ð¾Ð²Ñ `JSON::XS`. РвклÑÑÐ°ÐµÑ ÑледÑÑÑие наÑÑÑойки:"
msgstr "`Aion::Format::Json` uses `JSON::XS` as a base. And includes the following settings:"
msgid ""
"* allow_nonref â ÑкалÑÑÑ ÐºÐ¾Ð´Ð¸ÑÐ¾Ð²Ð°Ð½Ð¸Ñ Ð¸ декодиÑованиÑ.\n"
"* indent â вклÑÑиÑÑ Ð¼Ð½Ð¾Ð³Ð¾ÑÑÑоÑнÑй ÑекÑÑ Ñ Ð¾ÑÑÑÑпом в наÑале ÑÑÑоки.\n"
"* space_after â `\\n` поÑле json.\n"
"* canonical â ÑоÑÑиÑовка клÑÑей в Ñ
еÑаÑ
."
msgstr ""
"* allow_nonref - encoding and decoding scalars.\n"
"* indent â enable multiline text with indentation at the beginning of the line.\n"
"* space_after â `\\n` after json.\n"
"* canonical - sorting keys in hashes."
msgid "ÐеÑÐµÐ²Ð¾Ð´Ð¸Ñ Ð´Ð°Ð½Ð½Ñе в ÑоÑÐ¼Ð°Ñ json."
msgstr "Converts data to json format."
msgid "РазбиÑÐ°ÐµÑ ÑÑÑÐ¾ÐºÑ Ð² ÑоÑмаÑе JSON в ÑÑÑÑкÑÑÑÑ Perl."
msgstr "Parses a JSON string into a Perl structure."
msgid "â **GPLv3**"
msgstr "â **GPLv3**"
msgid "The Aion::Format::Json module is copyright © 2023 Yaroslav O. Kosmina. Rusland. All rights reserved."
msgstr "The Aion::Format::Json module is copyright © 2023 Yaroslav O. Kosmina. Rusland. All rights reserved."
lib/Aion/Format/Json.md view on Meta::CPAN
!ru:en
# NAME
Aion::Format::Json - ÑаÑÑиÑение Perl Ð´Ð»Ñ ÑоÑмаÑиÑÐ¾Ð²Ð°Ð½Ð¸Ñ JSON
# SYNOPSIS
```perl
use Aion::Format::Json;
to_json {a => 10} # => {\n "a": 10\n}\n
from_json '[1, "5"]' # --> [1, "5"]
```
# DESCRIPTION
`Aion::Format::Json` иÑполÑзÑÐµÑ Ð² каÑеÑÑве оÑÐ½Ð¾Ð²Ñ `JSON::XS`. РвклÑÑÐ°ÐµÑ ÑледÑÑÑие наÑÑÑойки:
* allow_nonref â ÑкалÑÑÑ ÐºÐ¾Ð´Ð¸ÑÐ¾Ð²Ð°Ð½Ð¸Ñ Ð¸ декодиÑованиÑ.
* indent â вклÑÑиÑÑ Ð¼Ð½Ð¾Ð³Ð¾ÑÑÑоÑнÑй ÑекÑÑ Ñ Ð¾ÑÑÑÑпом в наÑале ÑÑÑоки.
* space_after â `\n` поÑле json.
* canonical â ÑоÑÑиÑовка клÑÑей в Ñ
еÑаÑ
.
# SUBROUTINES
## to_json (;$data)
lib/Aion/Format/Json.md view on Meta::CPAN
';
to_json $data # -> $result
local $_ = $data;
to_json # -> $result
```
## from_json (;$string)
РазбиÑÐ°ÐµÑ ÑÑÑÐ¾ÐºÑ Ð² ÑоÑмаÑе JSON в ÑÑÑÑкÑÑÑÑ Perl.
```perl
from_json '{"a": 10}' # --> {a => 10}
[map from_json, "{}", "2"] # --> [{}, 2]
```
# AUTHOR
Yaroslav O. Kosmina <darviarush@mail.ru>
lib/Aion/Format/Json.pm view on Meta::CPAN
package Aion::Format::Json;
use common::sense;
use JSON::XS qw//;
use Exporter qw/import/;
our @EXPORT = our @EXPORT_OK = grep {
*{$Aion::Format::Json::{$_}}{CODE} && !/^(_|(NaN|import)\z)/n
} keys %Aion::Format::Json::;
#@category json
# ÐаÑÑÑаиваем json
our $JSON = JSON::XS->new->allow_nonref->indent(1)->space_after(1)->canonical(1);
# Ð json
sub to_json(;$) {
$JSON->encode(@_ == 0? $_: @_)
}
# Ðз json
sub from_json(;$) {
$JSON->decode(@_ == 0? $_: @_)
}
1;
__END__
=encoding utf-8
=head1 NAME
Aion::Format::Json - Perl extension for JSON formatting
=head1 SYNOPSIS
use Aion::Format::Json;
to_json {a => 10} # => {\n "a": 10\n}\n
from_json '[1, "5"]' # --> [1, "5"]
=head1 DESCRIPTION
C<Aion::Format::Json> uses C<JSON::XS> as a base. And includes the following settings:
=over
=item * allow_nonref - encoding and decoding scalars.
=item * indent â enable multiline text with indentation at the beginning of the line.
=item * space_after â C<\n> after json.
=item * canonical - sorting keys in hashes.
lib/Aion/Format/Json.pm view on Meta::CPAN
}
';
to_json $data # -> $result
local $_ = $data;
to_json # -> $result
=head2 from_json (;$string)
Parses a JSON string into a Perl structure.
from_json '{"a": 10}' # --> {a => 10}
[map from_json, "{}", "2"] # --> [{}, 2]
=head1 AUTHOR
Yaroslav O. Kosmina L<mailto:darviarush@mail.ru>
=head1 LICENSE
t/aion/format/json.t view on Meta::CPAN
use common::sense; use open qw/:std :utf8/; use Carp qw//; use Cwd qw//; use File::Basename qw//; use File::Find qw//; use File::Slurper qw//; use File::Spec qw//; use File::Path qw//; use Scalar::Util qw//; use Test::More 0.98; use String::Diff q...
# # NAME
#
# Aion::Format::Json - ÑаÑÑиÑение Perl Ð´Ð»Ñ ÑоÑмаÑиÑÐ¾Ð²Ð°Ð½Ð¸Ñ JSON
#
# # SYNOPSIS
#
subtest 'SYNOPSIS' => sub {
use Aion::Format::Json;
local ($::_g0 = do {to_json {a => 10}}, $::_e0 = "{\n \"a\": 10\n}\n"); ::ok $::_g0 eq $::_e0, 'to_json {a => 10} # => {\n "a": 10\n}\n' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {from_json '[1, "5"]'}, $::_e0 = do {[1, "5"]}); ::is_deeply $::_g0, $::_e0, 'from_json \'[1, "5"]\' # --> [1, "5"]' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
#
# # DESCRIPTION
#
# `Aion::Format::Json` иÑполÑзÑÐµÑ Ð² каÑеÑÑве оÑÐ½Ð¾Ð²Ñ `JSON::XS`. РвклÑÑÐ°ÐµÑ ÑледÑÑÑие наÑÑÑойки:
#
# * allow_nonref â ÑкалÑÑÑ ÐºÐ¾Ð´Ð¸ÑÐ¾Ð²Ð°Ð½Ð¸Ñ Ð¸ декодиÑованиÑ.
# * indent â вклÑÑиÑÑ Ð¼Ð½Ð¾Ð³Ð¾ÑÑÑоÑнÑй ÑекÑÑ Ñ Ð¾ÑÑÑÑпом в наÑале ÑÑÑоки.
# * space_after â `\n` поÑле json.
# * canonical â ÑоÑÑиÑовка клÑÑей в Ñ
еÑаÑ
.
#
# # SUBROUTINES
#
# ## to_json (;$data)
#
t/aion/format/json.t view on Meta::CPAN
';
local ($::_g0 = do {to_json $data}, $::_e0 = do {$result}); ::ok defined($::_g0) == defined($::_e0) && $::_g0 eq $::_e0, 'to_json $data # -> $result' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local $_ = $data;
local ($::_g0 = do {to_json}, $::_e0 = do {$result}); ::ok defined($::_g0) == defined($::_e0) && $::_g0 eq $::_e0, 'to_json # -> $result' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
#
# ## from_json (;$string)
#
# РазбиÑÐ°ÐµÑ ÑÑÑÐ¾ÐºÑ Ð² ÑоÑмаÑе JSON в ÑÑÑÑкÑÑÑÑ Perl.
#
::done_testing; }; subtest 'from_json (;$string)' => sub {
local ($::_g0 = do {from_json '{"a": 10}'}, $::_e0 = do {{a => 10}}); ::is_deeply $::_g0, $::_e0, 'from_json \'{"a": 10}\' # --> {a => 10}' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {[map from_json, "{}", "2"]}, $::_e0 = do {[{}, 2]}); ::is_deeply $::_g0, $::_e0, '[map from_json, "{}", "2"] # --> [{}, 2]' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
#
# # AUTHOR
#
# Yaroslav O. Kosmina <darviarush@mail.ru>
( run in 2.182 seconds using v1.01-cache-2.11-cpan-cdf2f3d4e48 )