Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Pretty-print your JSON!
PHP
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
README.md
json_pretty.php

README.md

json_pretty

A JSON pretty-printer for PHP. Usage:

echo json_pretty(json_encode($data));

The output style of this function is highly configurable. There are 2 built-in styles included. See the source.

Example

An example of prettyprinted JSON:

{ "updated": 1304434891,
  "crews": [
    { "rank": 1,
      "previousRanks": [ 11, 323 ],
      "emblemPlate": { "id": "816833289" },
      "emblemPattern": { "id": "1353236320" },
      "name": "BBG-RM3",
      "points": 1517,
      "course": {
        "stages": [
          { "pattern": "cosmicfantastic_3",
            "effects": { "fade": "-", "line": "-", "scroll": "-" } },
          { "pattern": "supersonicrmx_3",
            "effects": { "fade": "-", "line": "-", "scroll": "-" } },
          { "pattern": "someday_3",
            "effects": { "fade": "-", "line": "-", "scroll": "-" } } ],
        "producer": "BOAT",
        "plays": 21,
        "wins": 17 } } ],
  "round": 19 }

Looks nice don't you think?

Something went wrong with that request. Please try again.