JSON::Whitespace(3pm)

JSON::Whitespace3pm

Alter the insignificant whitespace of json

Usage

    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}}

Version

This documents version 0.62 of JSON::Whitespace corresponding to git commit d04630086f6c92fea720cba4568faa0cbbdde5a6 <https://github.com/benkasminbullock/JSON-Parse/commit/d04630086f6c92fea720cba4568faa0cbbdde5a6> released on Sat Jul 16 08:23:13 2022 +0900.

Overview

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).

Functions

json_indent

    my $indented = json_indent ($json);

Add indentation to $json.

json_minify

    my $minified = json_minify ($json);

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

Releases

4 releases since Debian 11 (Bullseye); the text changed 3 times.

  1. 11
  2. 12
  3. 13
  4. Arch

Author

Ben Bullock, <[email protected]>

From perl-json-parse 0.62-6 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.