JSON TO SELECTION
JSON TO SELECTION ( aTable ; jsonArray )
Parameter | Type | Description | |
---|---|---|---|
aTable | Table | 🡒 | 4D table into which elements are copied |
jsonArray | Text | 🡒 | Array of objects in JSON |
Description
"[{"attribute1":"value1","attribute2":"value2",...},...,{"attribute1":"valueN","attribute2":"valueN",...}]"
Example
Using the JSON TO SELECTION command to add records to the [Company] table:
var $Object1;$Object2;$Object3;$Object4 : Object
var $ObjectString : Text
ARRAY OBJECT($arrayObject;0)
OB SET($Object1;"ID";"200";"Company Name";"4D SAS";"City";"Clichy")
APPEND TO ARRAY($arrayObject;$Object1)
OB SET($Object2;"ID";"201";"Company Name";"APPLE";"City";"Paris")
APPEND TO ARRAY($arrayObject;$Object2)
OB SET($Object3;"ID";"202";"Company Name";"IBM";"City";"London")
APPEND TO ARRAY($arrayObject;$Object3)
OB SET($Object4;"ID";"203";"Company Name";"MICROSOFT";"City";"New York")
APPEND TO ARRAY($arrayObject;$Object4)