Acme::IsItJSON - Is my variable JSON or a Perl data structure?
use Acme::IsItJSON 'is_it_json'; my $json = '{"zilog":"z80"}'; is_it_json ($json); my $perl = {zilog => 'z80'}; is_it_json ($json);
Not sure if your variable is a Perl data structure or a JSON string?
This Perl module can help.
Given a variable containing something which you are not sure about, and it may or may not be JSON or a Perl data structure, feed it to this routine. This module uses support vector machines running on an OCAML cluster backed up by a Node pipeline in an S3 cloud to distinguish JSON from Perl data structures.
JSON::Meth - does something similar to this module
Ben Bullock <bkb@cpan.org>
You can use Acme::IsItJSON under the same terms as Perl itself. Alternatively, you can throw it in the fruit cellar where it belongs.
To install Acme::IsItJSON, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Acme::IsItJSON
CPAN shell
perl -MCPAN -e shell install Acme::IsItJSON
For more information on module installation, please visit the detailed CPAN module installation guide.