GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
JSON::Whitespace(3) User Contributed Perl Documentation JSON::Whitespace(3)

JSON::Whitespace - Alter the insignificant whitespace of JSON

    use JSON::Whitespace ':all';
    
    my $in = <<EOF;
    {
                "animals":{
                        "kingkong":"🦍"
                },
                "baka":[
                        "ドジ"
                ],
                "fruit":{
                        "grape":"🍇"
                },
                "moons":{
                        "🌑":0
                }
        }
    EOF
    my $minify = json_minify ($in);
    print $minify;

This outputs

    {"animals":{"kingkong":"🦍"},"baka":["ドジ"],"fruit":{"grape":"🍇"},"moons":{"🌑":0}}

This documents version 0.61 of JSON::Whitespace corresponding to git commit 033269fa8972fdce8626aa65cd11a5394ab50492 <https://github.com/benkasminbullock/JSON-Parse/commit/033269fa8972fdce8626aa65cd11a5394ab50492> released on Thu Feb 11 09:14:04 2021 +0900.

This module offers functions to manipulate the "insignificant whitespace" part of a JSON string (the whitespace which is not inside strings). According to the JSON specification "insignificant whitespace" consists of space (%x20), horizontal tab (%x09), line feed or new line (%x0A) and carriage return (%x0D).

    my $indented = json_indent ($json);

Add indentation to $json.

    my $minified = json_minify ($json);

Remove all whitespace, including trailing newlines, from $json.

Documentation about JSON is in JSON::Parse. JSON::Whitespace is based on JSON::Tokenize, which breaks JSON into tokens without putting it into Perl structures.

Ben Bullock, <bkb@cpan.org>

This package and associated files are copyright (C) 2016-2021 Ben Bullock.

You can use, copy, modify and redistribute this package and associated files under the Perl Artistic Licence or the GNU General Public Licence.

2021-02-11 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.