1. Concepts
  2. Data Structures

Concepts

Data Structures

Data Structures in Stubber are based on JSON. Referencing data is done by specifying the path to the data in the JSON structure.

Basic Principle

Stubber uses JSON structures as the underlying data structure.
JSON consists of key-value pairs, where the value can be a string, number, boolean, array, or another JSON object.

All parts of Stubber, such as templates, actions, tasks, notifications, and fields, are based on JSON structures.
Referencing data is done by specifying the path to the data in the JSON structure.

To reference data in a JSON structure, you use a path that consists of the keys to the data.

For example in the following JSON structure:

        {
  "stub": {
    "data": {
      "name": "John Doe",
      "age": 30,
      "pets": [
        {
          "name": "Fluffy",
          "type": "cat"
        },
        {
          "name": "Rex",
          "type": "dog"
        }
      ]
    }
  }
}

      

To reference the name field, you would use the path stub.data.name.
To reference the type field of the second pet, you would use the path stub.data.pets[1].type.

You use substitution to reference data in the JSON structure and replace it with the actual value.

TIP

To quickly get the path to a data point in a stub, you can click on the key in the data tab of the stub details or when viewing the data in a stub post.

This will copy the path to the clipboard.

Copy Path