This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
||||||||||||||||||||||||||||||||||
|
4D v20.6
Overview of JSON commands
|
Type | Description | Comments | |||||||||||
string | Any Unicode character except for " and \
| \ is used for control characters:
| |||||||||||
number | Integer or floating point number | Number similar to a C or Java number, except that the octal and hexadecimal formats are not used | |||||||||||
object | { } | ||||||||||||
array | [ ] | ||||||||||||
boolean | true or false | ||||||||||||
null | null |
JSON objects are defined by braces and can contain an undefined number of name/value pairs, for example:
{ "firstName":"John" , "lastName":"Doe" }
JSON objects can be stored and handled in 4D through object variables (C_OBJECT) and fields.
JSON arrays are defined by brackets. Each array can contain an undefined number of elements of various types:
{ "employees": [ { "firstName":"John" , "lastName":"Doe" }, { "firstName":"Anna" , "lastName":"Smith" }, { "firstName":"Peter" , "lastName":"Jones" } ] }
JSON arrays can be stored and handled in 4D through variables of the collection type (C_COLLECTION).
4D supports JSON pointers. A JSON pointer is a string which can be used to access a particular field or key value in the entire JSON document. By convention, a URI containing a JSON pointer can be found in a JSON object property that must be named "$ref".
{ "$ref":<path>#<json_pointer> }
JSON pointers are resolved either when calling the JSON Resolve pointers command, or automatically when using Dynamic Forms.
Fore more information, please refer to the JSON Resolve pointers command description.
By default, when 4D dates are converted to and from JSON strings, they take into account the time zone of the machine where the conversion took place (in conformity with JavaScript). For example, in France (GMT+2), converting 23/08/2013 gives you "2013-08-22T22:00:000Z" and vice versa.
You can change this functioning and no longer take the time zone into account, during the implementation of export procedures for example, using the SET DATABASE PARAMETER command (Dates inside objects selector). Note that this selector can also influence the way dates are stored in objects.
Note: Starting with 4D v16 R6, JSON date strings in "YYYY-MM-DD" format can also be supported. For more information, please refer to the "Use date type instead of ISO date format in objects" option in the Compatibility page.
For more information about converting 4D/JSON dates, refer to .
Product: 4D
Theme: JSON
Modified: 4D v16 R5
4D Language Reference ( 4D v20)
4D Language Reference ( 4D v20.1)
4D Language Reference ( 4D v20.2)
4D Language Reference ( 4D v20.3)
4D Language Reference ( 4D v20.4)
4D Language Reference ( 4D v20.5)
4D Language Reference ( 4D v20.6)