|
|
|
|
- Encoding
- Content of variant
- Checking if a value is NULL
JSONToVariant (Function) In french: JSONVersVariant Converts a JSON string to a Variant variable.
sJZon is ANSI string = [ { "glossary": { "title": "example glossary", "GlossDiv": { "title": "S", "GlossList": { "GlossEntry": { "ID": "SGML", "SortAs": "SGML", "GlossTerm": "Standard Generalized Markup Language", "Acronym": "SGML", "Abbrev": "ISO 8879:1986", "GlossDef": { "para": "A meta-markup language, used to create markup languages such as DocBook.", "GlossSeeAlso": ["GML", "XML"] }, "GlossSee": "markup" } } } } } ] let jz = JSONToVariant(sJZon)
Syntax
<Result> = JSONToVariant(<JSON data>)
<Result>: Variant Name of Variant variable containing the conversion result. <JSON data>: ANSI character string encoded in 7-bit ASCII + JSON or UTF-8 encoding Character string containing the data in JSON format. Remarks Encoding The encoding used corresponds to the JSON standard: - 7-bit ASCII encoding for the first 128 characters, i.e., unaccented characters
- JSON encoding for the other characters: "\u" followed by the character code in 4-byte hexadecimal format. Example: for the "é" character (ASCII code 233, hexadecimal code E9), the encoding corresponds to "\u00E9".
Content of variant The content of the variant depends on the JSON used. It can correspond to: - the Null value
- a simple type: integer, string, boolean, etc.
- an array
- a complex object (VariantMember type, corresponding to an array of members where each member is a variant).
Checking if a value is NULL The "NULL" value is often used in JSON. To check the "NULL" value of a variant, you can: - use the Value property of the variant. For example:
v is Variant = JSONToVariant("{""m"":null}") IF v.m..Value = Null THEN Trace("NULL")
- check the NULL value directly. For example:
v is Variant = JSONToVariant("{""m"":null}") IF v.m = Null THEN Trace("NULL")
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|