Help / WLanguage / Managing databases / HFSQL / HFSQL functions
  • Type of import
  • Encoding
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WindowsLinuxPHPWEBDEV - Browser code
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Stored procedures
HJSONToRecord (Function)
In french: HJSONVersEnregistrement
HFSQL ClassicHFSQL Client/ServerAvailable 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
// Full message of the main error
// Browse the sub-errors (if any)
FOR i = 1 _TO_ ErrorInfo(errNumberSubError)
// Full message of each sub-error
Trace("Sub-error " + i + ": " + ErrorInfo(errMessage, i))
<Result> = HJSONToRecord(<Data file> , <JSON data> [, <List of items to import> [, <List of "items" 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>: Character string) or JSON variable
JSON data to be converted to record. This data can correspond to a JSON string or to a JSON variable.
<List of items to import>: Optional character string
List of names of items in the data file into which the import will be performed. The names can be delimited by single quotes and are separated by commas or CR (Carriage Return) characters. The names of the composite key items, binary memo items and binary items are ignored.
The non-imported items will be initialized with their default value described in the analysis.
If this parameter is not specified or corresponds to 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 "items" to import>: Optional character string
List of JSON item names to import. If this parameter is not specified or is an empty string (""), all JSON items are imported.
If an item remains is not found, a non-fatal error is returned.

Type of import

If the list of items is specified: the import will find the "JSON items" with the same name as the items.
Example: The data file described in the analysis contains the following items: ITEM1, ITEM2, ... The JSON file must have the following structure:
"Item1":Data of item 1,
"Item2":Data of item 2,
The names of items found in the JSON file that do not exist in the analysis or that are not specified in the list of items will be ignored during the import.
If the list of JSON items is not specified, the value of the JSON items is included in the item of the HFSQL data file that is named like the JSON item.


The encoding used corresponds to the JSON standard:
  • 7-bit ASCII encoding, i.e. the first 128 characters, unaccented characters,
  • JSON encoding for the other characters: "\u" followed by the character code in 4-byte hexadecimal.
Example: for "é" (ASCII code 233, hexadecimal code E9), the encoding corresponds to "\u00E9".
Business / UI classification: Business Logic
Component: wd300hf.dll
Minimum version required
  • Version 26
This page is also available for…
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help