Format Specification

This page describes the NiceDump version 1.0 format.

Format

A parsable NiceDump is created in the following way:

  1. Create a JSON representation of the object.
  2. Base64-encode the JSON data.
  3. Prepend the line =====BEGIN NICE-DUMP===== to the result.
  4. Append the line =====END NICE-DUMP===== to the result.
HTML
The NiceDump block SHOULD be enclosed by HTML comments <!-- and -->

Example

This example will create a NiceDump for the string variable "Foo Bar".

Create the JSON representation:

{ "name": "My String", "value": "Foo Bar", "type": "string", "size": 7 }

Base64-encode:

ewogICAgIm5hbWUiOiAiTXkgU3RyaW5nIiwKICAgICJ2YWx1ZSI6ICJGb28gQmFyIiwKICAgICJ0 eXBlIjogInN0cmluZyIsCiAgICAic2l6ZSI6IDcKfQ==

Prepend and append the NiceDump header and footer:

=====BEGIN NICE-DUMP===== ewogICAgIm5hbWUiOiAiTXkgU3RyaW5nIiwKICAgICJ2YWx1ZSI6ICJGb28gQmFyIiwKICAgICJ0 eXBlIjogInN0cmluZyIsCiAgICAic2l6ZSI6IDcKfQ== =====END NICE-DUMP=====

Done! A NiceDump reader can now parse this and might display something like this:

My String: "Foo Bar" string[7]

Item

An item corresponds to a basic entry in the NiceDump.

Comment

A comment for the item.

Name comment
Type string
Example {"comment": "Internal class"}

Is static

Tells whether the item is static or not. Default value is false.

Name isStatic
Type bool
Example {"isStatic": true}

Items

A list of items.

Items is an array of objects where each contains an optional key and a mandatory value. The key and value contains each another item.

Name items
Type array
Example {"items": [ {"key": {…}, "value": {…}}, {"value": {…}} ]}

Name

The name of the item.

Name name
Type string
Example {"name": "Foo Bar"}

Relation

The relation between the item and a parent item.

Name rel
Type string
Example {"rel": "parent"}
PHP
Relation MAY be parent (for a parent class item).

Size

The size of the item, e.g. the size of an array or a string.

Name size
Type number
Example {"size": 4}

Type

The native type name for the item or any of _group_, _text_.

Name type
Type string
Example {"type": "string"}
PHP
Type MUST be any of null, bool, int, float, string, array, object, resource, _group_, _text_.

Type name

The specific name for the type, e.g. the class name for an object.

Name typeName
Type string
Example {"typeName": "FooClass"}

Value

The value to display for the item.

Name Value
Type string
Example {"value": "42"}

Visibility

The visibility for the item.

Name visibility
Type string
Example {"visibility": "public"}
PHP
Visibility MUST be any of public, protected, private.