public static function format($json, $html = false)
    {
        $format = str_replace(
            [
                '    ',
                '\/',
            ], [
                '  ',
                '/',
            ], json_encode(
                json_decode(
                    str_replace(
                        [
                            "\n",
                            '  ',
                            ', }',
                            ', ]',
                            ',}',
                            ',]',
                        ],
                        [
                            '',
                            '',
                            '}',
                            '}',
                            '}',
                            ']',
                        ],
                        $json
                    )
                ),
                JSON_PRETTY_PRINT
            )
        );

        if ($html) {
            return str_replace("\n", '<br/>', $format);
        }

        return $format;
    }