The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Syntax::Highlight::JSON2 - syntax highlighting for JSON

SYNOPSIS

  use Syntax::Highlight::JSON2;
  my $syntax = "Syntax::Highlight::JSON2"->new;
  print $syntax->highlight($filehandle);

DESCRIPTION

Outputs pretty syntax-highlighted HTML for JSON. (Actually just adds <span> elements with class attributes. You're expected to bring your own CSS.)

There's nothing significant in the number "2" in the name of this module. There was just already a Syntax::Highlight::JSON on CPAN, which seems completely undocumented so I'm a little scared to use it!

Methods

highlight($input)

Highlight some JSON.

$input may be a file handle, filename or a scalar ref of text.

Returns a string of HTML.

tokenize($input)

This is mostly intended for subclassing Syntax::Highlight::JSON.

$input may be a file handle, filename or a scalar ref of text.

Returns an arrayref of token objects. The exact API for the token objects is subject to change, but currently they support TYPE and spelling methods.

BUGS

Please report any bugs to http://rt.cpan.org/Dist/Display.html?Queue=Syntax-Highlight-RDF.

SEE ALSO

Syntax::Highlight::RDF, Syntax::Highlight::XML.

AUTHOR

Toby Inkster <tobyink@cpan.org>.

COPYRIGHT AND LICENCE

This software is copyright (c) 2013 by Toby Inkster.

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

DISCLAIMER OF WARRANTIES

THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.