JSON::Util(3pm)

πŸ“¦
version 0.06 Β· 2 versions
, in fedora 43

πŸ’– JSON::Util β€” the manual, but make it cute πŸ’–

okay bestie, sit down, hydrate, and let me tell you about JSON::Util(3pm) β€” a User Contributed Perl Documentation page that is genuinely just easy and portable encode/decode of JSON. That's the whole vibe. It's giving "no drama, just data". πŸ¦‹


✨ NAME ✨

JSON::Util β€” easy and portable encode/decode of JSON. periodt. πŸ’…


🌸 SYNOPSIS 🌸

here's the tea, copy-paste ready, not a single character changed:

use JSON::Util;
$data = JSON::Util->decode('{"bar": "foo"}');
$data = JSON::Util->decode('some.json');
JSON::Util->encode({ 'foo' => 'bar' }, 'someother.json');

$data = JSON::Util->decode(['..', 'folder', some.json]);
JSON::Util->encode([123,321], ['..', 'folder', someother.json]);

print JSON::Util->encode([987,789]), "\n";
print JSON::Util->encode({987 => 789}), "\n";

my $json = JSON::Util->new(pretty => 0, convert_blessed => 1);
print $json->encode([ $object, $object2 ]);

# with file locking
$data = JSON::Util->decode(['..', 'folder', some.json], { 'LOCK_SH' => 1 });
$data = JSON::Util->decode(['..', 'folder', some.json], { 'LOCK_SH' => 1, LOCK_NB => 1 });
JSON::Util->encode([123,321], ['..', 'folder', someother.json], { 'LOCK_EX' => 1 });
JSON::Util->encode([123,321], ['..', 'folder', someother.json], { 'LOCK_EX' => 1, LOCK_NB => 1 });

see how it just... works? iconic. πŸŽ€


🫢 DESCRIPTION 🫢

bestie. The DESCRIPTION section is empty. Nothing. A void. It's giving mystery, it's giving "the methods speak for themselves". So scroll down, the methods are right there. πŸ’€


πŸ‘‘ METHODS πŸ‘‘

🌟 new()

Object constructor, aka the glow-up button. You only need it when the default_json configuration needs to be changed. Any key/value you pass as a parameter will be called on JSON::MaybeXS->new() as $json->$key($value). Yes queen, it's just chaining for you. ✨

🌟 default_json

Returns JSON::MaybeXS->new() with:

'utf8'            => 1,
'pretty'          => 1,
'convert_blessed' => 1,

that's the whole starter pack, and honestly? ate. πŸ’…

🌟 json

Returns the current JSON::MaybeXS object. That's it. That's the method. πŸŽ€

🌟 decode($what, [$opt])

Return a ref with decoded $what. See IO::Any for $where and $opt description. πŸ‘€

🌟 encode($data, [$where], [$opt])

Returns encoded $data. If $where is passed then the result is written there. See IO::Any for $where and $opt description. 🌈


πŸ’œ AUTHOR πŸ’œ

Jozef Kutej, "<jkutej at cpan.org>" β€” the actual main character who wrote this. respect. πŸ‘‘


😭 BUGS 😭

Please report any bugs or feature requests to "bug-json-util at rt.cpan.org", or through the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=JSON-Util>.

I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. fr fr, you're on the list. 🫢


🌈 SUPPORT 🌈

You can find documentation for this module with the perldoc command.

perldoc JSON::Util

You can also look for information at:

  • RT: CPAN's request tracker

<http://rt.cpan.org/NoAuth/Bugs.html?Dist=JSON-Util>

  • AnnoCPAN: Annotated CPAN documentation

<http://annocpan.org/dist/JSON-Util>

  • CPAN Ratings

<http://cpanratings.perl.org/d/JSON-Util>

  • Search CPAN

<http://search.cpan.org/dist/JSON-Util>


πŸŽ€ ACKNOWLEDGEMENTS πŸŽ€

The following people have contributed to the Sys::Path by committing their code, sending patches, reporting bugs, asking questions, suggesting useful advises, nitpicking, chatting on IRC or commenting on my blog (in no particular order):

John SJ Anderson

one (1) legend. shoutout. πŸ’–


Copyright 2009 Jozef Kutej, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


and that's the whole page bestie β€” no notes, no cap, we love a tiny module that does exactly one thing and does it flawlessly. πŸ’…βœ¨

mwah πŸ’– this was perl v5.42.0, dated 2025-07-25 β€” go forth and encode responsibly, ily, bye! πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from