PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • Encoding
  • Content of variant
  • Checking if a value is NULL
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Converts a JSON string to a Variant variable.
Versions 20 and later
iPhone/iPad This function is now available for iPhone/iPad applications.
New in version 20
iPhone/iPad This function is now available for iPhone/iPad applications.
iPhone/iPad This function is now available for iPhone/iPad applications.
Versions 21 and later
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Versions 22 and later
Android This function is now available for Android applications.
Android Widget This function is now available in Android widget mode.
WEBDEV - Browser code This function is now available in browser code.
New in version 22
Android This function is now available for Android applications.
Android Widget This function is now available in Android widget mode.
WEBDEV - Browser code This function is now available in browser code.
Android This function is now available for Android applications.
Android Widget This function is now available in Android widget mode.
WEBDEV - Browser code This function is now available in browser code.
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")
Component: wd270xml.dll
Minimum version required
  • Version 19
This page is also available for…
Comments
Click [Add] to post a comment