Really Useful Box2D Editor iforce2d

Back to main page

Exported JSON file structure


Here is the JSON structure exported by the R.U.B.E editor. Click on the small plus icons to expand each object and see more information about them.

The structure below shows all possible values that the JSON can contain, but in many cases values are omitted from the file to keep size to a minimum. Values that are not present in the JSON file should be interpreted as zero, false or empty string (for numeric, bool and string values respectively).

Please note that values shown below are not default values, they are merely there to show what the type of each property is.

*IMPORTANT* This is not the .rube file format! This is the exported JSON format, typically given a .json extension. You can see more info about this in the built-in help, in the topic "Using exported data -> Difference between saving and exporting".

This page uses the excellent Quick Json Formatter by Vladimir Bodurov. Click here to find out more about this tool.


//An example vector object - this is what is meant below when the value type is given as (vector).
A special case is the zero vector (0,0) which is represented as simply the numeric 0 value.
{
    "x": 1.2, 
    "y": 3.4
}

//An example vector array object - this is what is meant below when the value type is
//given as (vector array).
{
    "x": [
        1.2, 
        3.4, 
        5.6
    ], 
    "y": [
        2.1, 
        4.3, 
        6.5
    ]
}

//Example custom property objects. These will have a "name" property, and one other property.
//Depending on the type of the custom property, this will be called either "int", "float",
//"string", "vec2", "color" or "bool" and the value type will correspond to this. The two examples
//below show how float and string values would appear. In the main section below, this kind
//of object will be called (custom property)
{
    "name": "respawn_timeout", 
    "float": 2.5
}

{
    "name": "home_area", 
    "string": "basement"
}


//World object - the root object of the file
{
    "gravity": (vector), 
    "allowSleep": true, 
    "autoClearForces": true, 
    "positionIterations": 3, 
    "velocityIterations": 8, 
    "stepsPerSecond": 60, 
    "warmStarting": true, 
    "continuousPhysics": true, 
    "subStepping": false, 
    "body": //An array of zero or more body objects.
      [], 
    "image": //An array of zero or more image objects.
      [], 
    "joint": //An array of zero or more joint objects.
      []
}