In this article:

Supported Structures

Supported Data Types

One Data Type

Several Data Types

Table JSON Service

A basic procedure can be developed using a table with JSON Schema basic scalar types and corresponding internal platform types:

JSON Schema Basic Scalar Type

Internal platform type

number

double

string

text

boolean

bigint

Supported Structures

In the field of the JSON Schema resource one can set objects with similar structure or schemas describing objects:

{
    "id": 1,
    "name": "my_name",
    "text": "my_text"
}

NOTE. This structure is sent to a mobile client in the scalar_table_ table.

[
    {
        "id": 1,
        "name": "my_name1",
        "text": "my_text1"
    },
    {
        "id": 2,
        "name": "my_name2",
        "text": "my_text2"
    }
]

NOTE. If data is sent without table name, data is sent to a mobile client with the output_table name.

{
    "My_Table":
    [
        {
            "id": 1,
            "name": "my_name1",
            "text": "my_text1"
        },
        {
            "id": 2,
            "name": "my_name2",
            "text": "my_text2"
        }
    ]
}

{
    "Table1":
    [
        {
            "id_table1": 1,
            "name_table1": "my_name1",
            "text_table1": "my_text1"
        },
        {
            "id_table1": 2,
            "name_table1": "my_name2",
            "text_table1": "my_text2"
        }
    ],
    "Table2":
    [
        {
            "id_table2": 1,
            "name_table2": "my_name1",
            "text_table2": "my_text1"
        },
        {
            "id_table2": 2,
            "name_table2": "my_name2",
            "text_table2": "my_text2"
        }
    ]
}

{
    "my_key": "qwerty",
    "new_id": 12,
    "My_Table":
    [
        {
            "id": 1,
            "name": "my_name1",
            "text": "my_text1"
        },
        {
            "id": 2,
            "name": "my_name2",
            "text": "my_text2"
        }
    ]
}

NOTE. Additional keys are sent to a mobile client in the scalar_table_ table.

Supported Data Types

For each key one can set both one and several data types.

Available data types:

One Data Type

The example of keys with one data type:

[
   {
       "id": 1,
       "name": "my_name1",
       "text": true,
       "order": null
   },
   {
       "id": 2,
       "name": "my_name2",
       "text": false,
       "order": null
   }
]

When converting a JSON object to a JSON schema, data type of key values will be specified as a data type for the mentioned keys:

Key Value

Data type

id 1 Integer
2
name "my_name1" String
"my_name2"
text true Boolean
false
order null null

If the data source returns values with non-corresponding data type, the error occurs.

Several Data Types

Several data types can be specified for the same key if one of the conditions is satisfied:

The example of keys with several data types:

[
   {
       "id": 1,
       "name": "my_name1",
       "text": true,
       "order": null,
       "count": 10
   },
   {
       "id": 2,
       "name": null,
       "text": false,
       "order": "order_245",
       "count": 10.25
   },
   {
       "id": 3,
       "name": null,
       "text": "false",
       "order": null,
       "count": 15
   }
]

When converting a JSON object to a JSON schema, data type of key values will be specified as a data type for the mentioned keys:

Key

Value

Data type

Comments

id 1 Integer For this key one can specify values with the Integer type only.
2
3
name "my_name1" String, null For this key one can specify values with the String and null data types only.
null
text true Boolean, String

For this key one can specify values with the String and Boolean data types only.

Values with the Boolean data type will be converted to String by mobile platform server.

Values in the True/False format will be sent to a mobile device.

false
"false"
order null String, null For this key one can specify values with the String and null data types only.
"order_245"
count 10 Number

For this key one can specify values with the Integer and Number data types only.

Values with the Integer data type will be converted to Number by mobile platform server.

10.25
15

If the JSON schema contains different data types (including String) for the same key, all values for this keys obtained from the data source will be converted to String, except for the null value.

If the JSON schema contains the Number data type specified for the key, while the data source returns Integer, Integer will be converted to Number.

If the value obtained from the data source is returned with the data type that is not specified in the JSON schema, mobile platform server returns an error.

See also:

Setting Up Integration with Table Data Sources | Basic CRUD Procedure