Loads a variable based on a Structured Data Type (SDT) from a JSON string received as a parameter.
[&Boolean =] &VarBasedOnSDT.FromJson(&String[, &Messages])
Where:
&String
Attribute or variable string with the JSON content.
&VarBasedOnSDT
Variable based on an SDT.
&Messages
Variable based on the GeneXus's Messages data type. In case of an error, it will contain the error information. This Parameter is optional.
Type returned:
Boolean.
It returns False in case of having an error; otherwise, it returns True. The assignment of the return value is optional.
Objects: Procedure, Transaction, Web Panel, Panel
Generators: .NET Framework .NET, Java
The FromJson method loads the &SDT structure from the &String variable content. The variable's JSON format must be compatible with the SDT's structure.
Data Type Mapping
The GeneXus basic data types are mapped to JSON data types in this way:
- Character, VarChar, LongVarChar → JSON string
- Boolean → JSON Boolean
- Numeric → JSON Number
- Collections → an ordered sequence of values, comma-separated and enclosed in square brackets
Ignored SDT Properties
The following properties are ignored in the process of serializing an SDT to JSON:
ToJson Method
Structured Data Type (SDT) object