DataWindow JSON
[TOC]
A DataWindow JSON is an object that contains elements representing the various aspects of a DataWindow.
The structure of DataWindow JSON is as follows:
{
"identity": "70c86603-983b-4bd9-adbc-259436e43cbd",
"version":1.0,
"platform":"PowerBuilder",
"mapping-method": 0,
"dataobject":{"name":"d_example",
"meta-columns": [COLUMN-META1, COLUMN-META2…],
"primary-rows": [DW-STANDARD-ROW1, DW-STANDARD-ROW2…],
"filter-rows": [DW-STANDARD-ROW1, DW-STANDARD-ROW2…],
"delete-rows": [DW-STANDARD-ROW1, DW-STANDARD-ROW2…],
"dwchilds":{"department_id": [SIMPLE-ROW1,SIMPLE-ROW2…],
"category_id": [SIMPLE-ROW1,SIMPLE-ROW2…]
…
}
}
}
Elements | Description |
---|---|
identity | A string identifying the format. Should keep unchanged. |
version | An integer specifying the format version. Currently it is 1.0. |
platform | A string specifying the platform where JSON string is generated. Values are: PowerBuilder, C#. |
mapping-method | An integer specifying the method for mapping columns. Values are: 0 -- Use the index of JSON item to map with the DataWindow column. 1 -- Use the index of meta-columns to map with the DataWindow column. 2 -- Use the key of JSON item to map with the DataWindow column. Note: ImportJson function supports only 0 and 1, and ImportJsonByKey function ignores this value. |
dataobject | An object indicating it is a DataWindow. |
name | A string specifying the name of the DataWindow object (DataObject). |
meta-columns (optional) | An array specifying the information of the DataWindow columns (excluding the computed columns). For elements about the column meta information, see COLUMN-META below. |
primary-rows (optional) | An array specifying the data row in the DataWindow primary buffer. For elements about the DataWindow row, see DW-STANDARD-ROW below. |
filter-rows (optional) | An array specifying the data row in the DataWindow filter buffer. For elements about the DataWindow row, see DW-STANDARD-ROW below. |
delete-rows (optional) | An array specifying the data row in the DataWindow delete buffer. For elements about the DataWindow row, see DW-STANDARD-ROW below. |
dwchilds (optional) | An object specifying the data in the DataWindowChild. The column name of the DataWindowChild is the key of dwchilds. The data row is SIMPLE-ROW. see SIMPLE-ROW below for more information. |
COLUMN-META
COLUMN-META is an object that contains elements representing the various aspects of the DataWindow column (but not the computed column).
{
"name": "department_id",
"index": 1,
"datatype": "long",
"nullable": 0
}
name -- (required) a string specifying the name of the column.
index -- (required) an integer specifying the sequence order of the column. This value will be used to map with the DataWindow column when the mapping-method value is set to 1.
datatype -- (required) a string specifying the type of the column. This value is not used by import.
nullable -- (required) an integer specifying whether to allow a null value. 0 - a null value is not allowed, 1 - a null value is allowed.
DW-STANDARD-ROW
DW-STANDARD-ROW is an object that contains elements representing the detailed information of the DataWindow row.
{
"row-status": 0,
"columns":{"column1": [CURRENT-VALUE, COLUMN-STATUS, ORIGINAL-VALUE],
"column2": [CURRENT-VALUE, COLUMN-STATUS, ORIGINAL-VALUE],
...
}
}
row-status -- (required) an integer specifying the status of the DataWindow row. 0 - NotModified!, 1 - DataModified!, 2 - New!, 3 - NewModified!.
columns -- (required) an object specifying the DataWindow column information including the current value, the column status, and the original value.
- CURRENT-VALUE: (required) The current value of the column, in the following data type: integer, string, boolean, or null.
- COLUMN-STATUS: (optional) An integer specifying the column status. 0 - (default) NotModified!, 1 - DataModified!.
- ORIGINAL-VALUE: (optional) The original value of the column, in the following data type: integer, string, boolean, or null. The default type is null.
SIMPLE-ROW
SIMPLE-ROW is an object that contains elements representing the simple information of the DataWindow row. The data must be in the following data type: integer, string, boolean, or null.
{ "column1":1, "column2":"name", "column3":true, "column4":null... }
Example
Here is an example of a DataWindow JSON string:
{
"identity": "70c86603-983b-4bd9-adbc-259436e43cbd",
"version": 1,
"platform": "PowerBuilder",
"mapping-method": 0,
"dataobject": {
"name": "d_employee",
"meta-columns": [
{
"name": "emp_id",
"index": 0,
"datatype": "long",
"nullable": 1
},
{
"name": "manager_id",
"index": 1,
"datatype": "long",
"nullable": 1
},
{
"name": "emp_fname",
"index": 2,
"datatype": "string",
"nullable": 1
},
{
"name": "emp_lname",
"index": 3,
"datatype": "string",
"nullable": 1
},
{
"name": "dept_id",
"index": 4,
"datatype": "long",
"nullable": 1
},
{
"name": "street",
"index": 5,
"datatype": "string",
"nullable": 1
},
{
"name": "city",
"index": 6,
"datatype": "string",
"nullable": 1
},
{
"name": "state",
"index": 7,
"datatype": "string",
"nullable": 1
},
{
"name": "zip_code",
"index": 8,
"datatype": "string",
"nullable": 1
},
{
"name": "phone",
"index": 9,
"datatype": "string",
"nullable": 1
},
{
"name": "status",
"index": 10,
"datatype": "string",
"nullable": 0
},
{
"name": "ss_number",
"index": 11,
"datatype": "string",
"nullable": 1
},
{
"name": "salary",
"index": 12,
"datatype": "decimal",
"nullable": 1
},
{
"name": "start_date",
"index": 13,
"datatype": "date",
"nullable": 1
},
{
"name": "termination_date",
"index": 14,
"datatype": "date",
"nullable": 1
},
{
"name": "birth_date",
"index": 15,
"datatype": "date",
"nullable": 1
},
{
"name": "bene_health_ins",
"index": 16,
"datatype": "string",
"nullable": 0
},
{
"name": "bene_life_ins",
"index": 17,
"datatype": "string",
"nullable": 0
},
{
"name": "bene_day_care",
"index": 18,
"datatype": "string",
"nullable": 0
}
],
"primary-rows": [
{
"row-status": 1,
"columns": {
"emp_id": [ 102 ],
"manager_id": [ 501 ],
"emp_fname": [ "Fran" ],
"emp_lname": [ "Whitney" ],
"dept_id": [ 400, 1, 100 ],
"street": [ "49 East Washington Street" ],
"city": [ "Needham" ],
"state": [ "MA" ],
"zip_code": [ "02192 " ],
"phone": [ "6175554321", 1, "6175553985" ],
"status": [ "A" ],
"ss_number": [ "017349033" ],
"salary": [ 50000, 1, 45700 ],
"start_date": [ "1994-02-26" ],
"termination_date": [ null ],
"birth_date": [ "1966-06-05" ],
"bene_health_ins": [ "Y" ],
"bene_life_ins": [ "Y" ],
"bene_day_care": [ "N" ]
}
},
{
"row-status": 0,
"columns": {
"emp_id": [ 129 ],
"manager_id": [ 902 ],
"emp_fname": [ "Philip" ],
"emp_lname": [ "Chin" ],
"dept_id": [ 200 ],
"street": [ "59 Pond Street" ],
"city": [ "Atlanta" ],
"state": [ "GA" ],
"zip_code": [ "30339 " ],
"phone": [ "4045552341" ],
"status": [ "A" ],
"ss_number": [ "024608923" ],
"salary": [ 38500 ],
"start_date": [ "2005-08-04" ],
"termination_date": [ null ],
"birth_date": [ "1974-10-30" ],
"bene_health_ins": [ "Y" ],
"bene_life_ins": [ "Y" ],
"bene_day_care": [ "N" ]
}
},
{
"row-status": 3,
"columns": {
"emp_id": [ 104, 1, null ],
"manager_id": [ 902, 1, null ],
"emp_fname": [ "Chris", 1, null ],
"emp_lname": [ "Young", 1, null ],
"dept_id": [ 200, 1, null ],
"street": [ "57 Carver Street", 1, null ],
"city": [ "Concord", 1, null ],
"state": [ "MA", 1, null ],
"zip_code": [ "12345 ", 1, null ],
"phone": [ "6185551234", 1, null ],
"status": [ "A", 1, null ],
"ss_number": [ "010123456", 1, null ],
"salary": [ 63000, 1, null ],
"start_date": [ "2018-05-06", 1, null ],
"termination_date": [ null ],
"birth_date": [ "1984-10-12", 1, null ],
"bene_health_ins": [ "Y", 1, null ],
"bene_life_ins": [ "Y", 1, null ],
"bene_day_care": [ null ]
}
}
],
"filter-rows": [
{
"row-status": 0,
"columns": {
"emp_id": [ 148 ],
"manager_id": [ 1293 ],
"emp_fname": [ "Julie" ],
"emp_lname": [ "Jordan" ],
"dept_id": [ 300 ],
"street": [ "144 Great Plain Avenue" ],
"city": [ "Winchester" ],
"state": [ "MA" ],
"zip_code": [ "01890 " ],
"phone": [ "6175557835" ],
"status": [ "A" ],
"ss_number": [ "501704733" ],
"salary": [ 51432 ],
"start_date": [ "2004-10-04" ],
"termination_date": [ null ],
"birth_date": [ "1959-12-13" ],
"bene_health_ins": [ "Y" ],
"bene_life_ins": [ "Y" ],
"bene_day_care": [ "N" ]
}
}
],
"delete-rows": [
{
"row-status": 0,
"columns": {
"emp_id": [ 105 ],
"manager_id": [ 501 ],
"emp_fname": [ "Matthew" ],
"emp_lname": [ "Cobb" ],
"dept_id": [ 100 ],
"street": [ "77 Pleasant Street" ],
"city": [ "Waltham" ],
"state": [ "MA" ],
"zip_code": [ "02154 " ],
"phone": [ "6175553840" ],
"status": [ "A" ],
"ss_number": [ "052345739" ],
"salary": [ 62000 ],
"start_date": [ "1994-07-02" ],
"termination_date": [ null ],
"birth_date": [ "1968-12-04" ],
"bene_health_ins": [ "Y" ],
"bene_life_ins": [ "Y" ],
"bene_day_care": [ "N" ]
}
}
],
"dwchilds": {
"dept_id": [
{
"dept_id": 100,
"dept_name": "R & D"
},
{
"dept_id": 200,
"dept_name": "Sales"
},
{
"dept_id": 300,
"dept_name": "Finance"
},
{
"dept_id": 400,
"dept_name": "Marketing"
},
{
"dept_id": 500,
"dept_name": "Shipping"
}
]
}
}
}