.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "JSON::Dumper::Compact 3pm" .TH JSON::Dumper::Compact 3pm "2020-06-13" "perl v5.30.3" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" JSON::Dumper::Compact \- JSON processing with Data::Dumper::Compact aesthetics .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use JSON::Dumper::Compact \*(Aqjdc\*(Aq; \& \& my $json = jdc($data); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" JSON::Dumper::Compact is a subclass of Data::Dumper::Compact that turns arrayrefs and hashrefs instead into \s-1JSON.\s0 .PP Deep data structures are rendered highly compactly: .PP .Vb 9 \& [ \& "1556933590.65383", "Fri May 3 18:33:10 2019", 26794, "INFO", 3, \& [ "SRV:8FB66F32" ], [ [ \& "/opt/voice\-srvc\-native/bin/async\-srvc\-att\-gateway\-poller", 33, \& "NERV::Voice::SRV::Native::AsyncSRVATTGatewayPoller::main", \& ] ], \& "batch_nena_messages returned", "OK", 6, { "FILENAME": "lqxw020323" }, \& 1556933584, "lqxw020323", \& ] .Ve .PP To ease debugging, blessed references without a \f(CW\*(C`TO_JSON\*(C'\fR method are rendered as an object with a single two-element arrayref value: .PP .Vb 4 \& { "_\|_bless_\|_": [ \& "The::Class", \& { "the": "object" }, \& ] } .Ve .SH "METHODS" .IX Header "METHODS" In addition to the Data::Dumper::Compact methods, we provide: .SS "encode" .IX Subsection "encode" .Vb 2 \& JSON::Dumper::Compact\->encode($data, \e%opts?); \& $jdc\->encode($data, \e%opts?); .Ve .PP Operates identically to \*(L"dump\*(R" in Data::Dumper::Compact but named to be less confusing to code expecting a \s-1JSON\s0 object. .SS "decode" .IX Subsection "decode" .Vb 2 \& JSON::Dumper::Compact\->decode($string, \e%opts?); \& $jdc\->decode($string, \e%opts); .Ve .PP Runs the supplied string through an JSON::MaybeXS \f(CW\*(C`decode\*(C'\fR with options set to be able to reliably reparse what we can currently format \- notably setting \f(CW\*(C`relaxed\*(C'\fR to allow for trailing commas and using \&\f(CW\*(C`filter_json_single_key_object\*(C'\fR to re-inflate blessed objects. .PP Note that using this method on untrusted data is a security risk. While \&\f(CW\*(C`encode\*(C'\fR/\f(CW\*(C`dump\*(C'\fR should be usable for \s-1JSON\s0 formatting, in general, \&\f(CW\*(C`decode\*(C'\fR fully rehydrates for debugging purposes and as such can e.g. cause \s-1DESTROY\s0 methods to be called unexpectedly, which can allow a malicious user to do things to your perl5 \s-1VM.\s0 Rather than using debugging specific code on untrusted data, use JSON::MaybeXS or Mojo::JSON directly (if the \f(CW\*(C`encode\*(C'\fR output doesn't parse correctly via other libraries, please report that as a bug).. .PP \&\s-1DO NOT USE THIS METHOD ON UNTRUSTED DATA IT WAS NOT DESIGNED TO BE SECURE.\s0 .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (c) 2019 the \*(L"\s-1AUTHOR\*(R"\s0 in Data::Dumper::Compact and \&\*(L"\s-1CONTRIBUTORS\*(R"\s0 in Data::Dumper::Compact as listed in Data::Dumper::Compact. .SH "LICENSE" .IX Header "LICENSE" This library is free software and may be distributed under the same terms as perl itself. See .