Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
Badger::Codec::JSON(3)User Contributed Perl DocumentatioBadger::Codec::JSON(3)

NAME
       Badger::Codec::JSON - encode/decode data	using JSON

SYNOPSIS
	   use Badger::Codec::JSON;
	   my $codec   = Badger::Codec::JSON->new();
	   my $encoded = $codec->encode({ msg => "Hello	World" });
	   my $decoded = $codec->decode($encoded);

DESCRIPTION
       This module implements a	subclass of Badger::Codec which	uses the
       JSON::XS	or JSON	module (whichever you have installed) to encode	and
       decode data to and from JSON. It	is little more than an adapter module
       to fit JSON into	the Badger::Codec mould.

METHODS
   encode($data)
       Encodes the Perl	data in	$data to a JSON	string.	This method is a
       wrapper around the internal the encode_json() subroutine.

	   $encoded = Badger::Codec::JSON->encode($data);

   decode($json)
       Decodes the encoded JSON	string in $json	back into a Perl data
       structure.  This	method is a wrapper around the internal	the
       decode_json() subroutine.

	   $decoded = Badger::Codec::JSON->decode($encoded);

   encoder()
       This method returns a reference to the real subroutine that's doing all
       the encoding work, i.e. the internal "encode_json()" subroutine.

   decoder()
       This method returns a reference to the real subroutine that's doing all
       the decoding work, i.e. the "decode_json()" subroutine in JSON.

INTERNAL SUBROUTINES
   encode_json($data)
       This is the internal subroutine that encodes the	JSON data.  It
       delegates to the	JSON::XS or JSON module, depending on which you	have
       installed.

   decode_json($json)
       This is the internal subroutine that decodes the	JSON data.  As per
       encode_json(), it delegates the task to the JSON::XS or JSON module.

AUTHOR
       Andy Wardley <http://wardley.org/>

COPYRIGHT
       Copyright (C) 2005-2009 Andy Wardley. All rights	reserved.

SEE ALSO
       Badger::Codecs, Badger::Codec, JSON

perl v5.32.0			  2016-12-12		Badger::Codec::JSON(3)

NAME | SYNOPSIS | DESCRIPTION | METHODS | INTERNAL SUBROUTINES | AUTHOR | COPYRIGHT | SEE ALSO

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=Badger::Codec::JSON&sektion=3&manpath=FreeBSD+12.2-RELEASE+and+Ports>

home | help