|
|
|
|
|
HJSONToRecord (Function) In french: HJSONVersEnregistrement
 Available only with these kinds of connection
Imports JSON data into the current record. let sString1 = "{ ""FirstName"":""Tintin"", ""FirstName"":[""Milou"", ""IDEFIX""] }"
let b1 = HJSONToRecord(Customer, sString1)
IF ErrorOccurred = True THEN
Trace(HErrorInfo())
FOR i = 1 _TO_ ErrorInfo(errNumberSubError)
Trace("Sub-error " + i + ": " + ErrorInfo(errMessage, i))
END
END
HAdd(Customer)
Syntax
<Result> = HJSONToRecord(<Data file> , <JSON data> [, <List of destination items> [, <List of JSON keys to import>]])
<Result>: Boolean - True if no problems were encountered during the import process,
- False otherwise. HErrorInfo returns more details about the problem.
<Data file>: Optional character string Name of the HFSQL data file used. JSON data is imported into the current record. <JSON data>: JSON string or variable JSON data to be converted to record. This data can correspond to a JSON string or to a JSON variable. <List of destination items>: Optional character string Names of items in the data file into which the JSON data is to be imported. These names can be delimited by simple quotes and separated by commas or carriage returns (CR). Items of type Composite key, Binary Memo and Binary are ignored. Items not included in this list will be initialized with the default value defined in the analysis. If this parameter is not specified or is an empty string (""), all items are imported (except compound keys, binary items and binary memos) in the order in which they were created in the physical file. <List of JSON keys to import>: Optional character string List of keys associated with the JSON values to be imported. If this parameter is not specified or is an empty string (""), the values associated with all JSON keys are imported. If there is no JSON data for one given item in the data file, a non-fatal error is returned. Remarks Type of import If the list of JSON keys is specified, all "JSON values" whose key names are identical to the names of the items in the data file will be imported. Example: The data file defined in the analysis contains the following items: ITEM1, ITEM2, etc. The JSON file should therefore have the following structure: {"File": { "ITEM1":Data of ITEM1, "ITEM2":Data of ITEM2, ... } } JSON keys that do not exist in the analysis or are not specified in the list of items will be ignored during the import. If the list of JSON keys is not specified, the values of the JSON keys are imported into the items of the HFSQL data file that have the same name as the JSON keys. Encoding The encoding used corresponds to the JSON standard: - 7-bit ASCII encoding, i.e. the first 128 characters, unaccented characters,
- JSON encoding for other characters: "\u" followed by the character code in 4-byte hexadecimal format.
For example, the "é" character (ASCII code 233, hexadecimal code E9) would be encoded as "\u00E9". Business / UI classification: Business Logic
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|