If you would like to upgrade to a newer long-term support version of Studio Pro, see Moving from Mendix Studio Pro 8 to 9.

JSON Structures

Last modified: August 20, 2024

General

A JSON structure document stores a JSON snippet, and converts it into a schema structure that can be used in Import Mappings and Export Mappings to convert JSON content to Mendix objects and vice versa.

JSON Snippet

Contains text of the JSON snippet. Usually it is pasted from API documentation, or you can enter it manually for simple JSON.

Format

Formattings and whitespacing of JSON snippets that are found in API documentations may vary. You can paste JSON into the document without bothering about whitespaces. The button ‘Format’ formats the JSON snippet in such a way that it is canonical and readable. The semantic contents of the snippets are not changed.

Structure

Shows a tree structure with a schema that is parsed from the JSON snippet. The following columns are available:

  • Name – this shows the name of a JSON element. If the JSON element does not have a name, it shows the element type within parentheses: (Object), (Array), (Wrapper) or (Value).
  • Value – this shows the original value of the element in the JSON snippet. It is used to make it easier to find back the original element in the snippet. It is not used in the rest of the model.
  • Primitive Type – shows the type of element after parsing.
  • Occurrence – shows the occurrence of the element. Typically JSON arrays have multiple occurrence (0..*) and JSON objects single occurrence (1).
  • Custom name – this column is editable. Often the name JSON objects or arrays can not be inferred from the snippet. For reference, you can modify the name of the JSON element. This name is important when you use Mapping documents based on the JSON schema. You will see this name in mapping elements, and it is used when you want to use “Map Automatically” to generate domain model entities and associations.

Documentation

Documentation that describes the snippet.

Parsing of the JSON Snippet

Simple JSON Objects

A simple JSON object is contained in curly braces (between ‘{’ and ‘}’). It contains a comma-separated list of JSON properties. See the following example.

Each JSON property is composed of a key (“name”) and a value (“John”). If the value is between double quotes (" “), it is considered a string, otherwise the type is derived from the value. The following JSON values are supported:

  • "string" – converted into an attribute of type String
  • 123 – converted into an attribute of type Integer
  • true or false – converted into an attribute of type Boolean
  • "1985-04-12T23:20:50.52Z" – converted into an attribute of type Date and time
  • 12.50 – converted into an attribute of type Decimal

JSON Arrays

A JSON array is contained in square brackets (between [ and ]). It contains a comma-separated list of JSON values or JSON objects.

  • a JSON array can be the root of the JSON snippet.
  • a JSON array can be contained within a JSON object
  • a JSON array can be contained within another JSON array.