Group
Extension

Matches 2

JSON-Repair ( B/BK/BKB/JSON-Repair-0.08.tar.gz, BKB, 2021; MetaCPAN )
JSON-Repair/lib/JSON/Repair.pm ( view source; MetaCPAN )
package JSON::Repair;
use parent Exporter;
our @EXPORT_OK = qw/repair_json/;
our %EXPORT_TAGS = (all => \@EXPORT_OK);
use warnings;
use strict;
use utf8;
use Carp;

# This Perl version is required bec
errors from
# JSON::Parse.

use 5.014;
use JSON::Parse '0.58';
use C::Tokenize '$comment_re';

our $VERSION = '0.08';

sub repair_json
{
    my ($broken, %options) = @_;
    my $jp = JSON::Parse->new 
ose};
    my $output = $broken;
    while (1) {
	# Try various repairs.  This continues until the JSON is
	# valid, or none of the repairs have worked. After a
	# successful repair, "next;" should be 
JSON-Repair ( B/BK/BKB/JSON-Repair-0.08.tar.gz, BKB, 2021; MetaCPAN )
JSON-Repair/lib/JSON/Repair.pod ( view source; MetaCPAN )


JSON::Repair - reformat JSON to strict compliance

=head1 SYNOPSIS

    
    use utf8;
    use JSON::Repair 'repair_json';
    my $bad_json = <<EOF;
    {'very bad':0123,
     "
    naughty":'json',
 00000.00001,
    }
    // garbage
    EOF
    print repair_json ($bad_json);


produces output

    {"very bad":123,
     "\nnaughty":"json",
    "value": 0.00001
    }


(This example is included as
RSION

This documents version 0.08 of JSON::Repair corresponding to
git commit L<0d223c0746505268a2a620e28a5917f0de928c3f|https://github.com/benkasminbullock/json-repair/commit/0d223c0746505268a2a620e

Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.