package JSON::Syck;
use strict;
use Exporter;
use YAML::Syck ();
our $VERSION = '1.36';
our @EXPORT_OK = qw( Load Dump LoadFile DumpFile DumpInto );
our @ISA = qw/Exporter/;
*Load = \&YAML:
:Syck::LoadJSON;
*Dump = \&YAML::Syck::DumpJSON;
sub DumpFile {
my $file = shift;
if ( YAML::Syck::_is_glob($file) ) {
my $err = YAML::Syck::DumpJSONFile( $_[0], $file );
if (
open( my $fh, '>', $file ) or die "Cannot write to $file: $!";
my $err = YAML::Syck::DumpJSONFile( $_[0], $fh );
if ($err) {
$! = 0 + $err;
die "Error writing
look at
L<YAML::XS>, or perhaps at looking another serialization format like
L<JSON>.
=head1 SEE ALSO
L<YAML>, L<JSON::Syck>
L<http://www.yaml.org/>
=head1 AUTHORS
Audrey Tang E<lt>cpan@audreyt.
/* #define YAML_IS_JSON 1 */
#include "perl_common.h"
#define YAML_IS_JSON 1
#include "perl_syck.h"
#undef YAML_IS_JSON
#include "perl_syck.h"
typedef PerlIO * OutputStream;
MODULE = YAML::Syck P
OutputStream out
SV *
LoadJSON (s)
char * s
SV *
DumpJSON (sv)
SV * sv
int
DumpJSONInto (in, out)
SV * in
SV * out
int
DumpJSONFile (in, out)
SV * in
ef PERL_SYCK_MARK_EMITTER
#undef PERL_SYCK_EMITTER_MARK_NODE_FLAGS
#ifdef YAML_IS_JSON
# define PACKAGE_NAME "JSON::Syck"
# define NULL_LITERAL "null"
# define NULL_LITERAL_LENGTH 4
# define SC
_NODES
int json_max_depth = 512;
char json_quote_char = '"';
static enum scalar_style json_quote_style = scalar_2quote;
# define SCALAR_STRING json_quote_style
# define SCALAR_QUOTED json_quote_styl
a)
# define PERL_SYCK_PARSER_HANDLER json_syck_parser_handler
# define PERL_SYCK_EMITTER_HANDLER json_syck_emitter_handler
# define PERL_SYCK_MARK_EMITTER json_syck_mark_emitter
# define PERL_SYCK
old,
scalar_literal,
scalar_plain,
scalar_2quote_1 /* Added by Audrey Tang to support JSON's single quoting */
};
/*
* Node metadata struct
*/
struct _syck_node {
/* Symbol table ID