Loads a variable based on a Structured Data Type (SDT) from a JSON string received as a parameter.
[&Boolean =] &SDT.FromJson(&String[, &Messages])
Attribute or variable string with the JSON content.
Variable based on an SDT.
Variable based on the GeneXus's Messages data type. In case of an error, it will contain the error information. This Parameter is optional.
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: GeneXus .NET Framework generator .NET, GeneXus Java Generator
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:
Structured Data Type (SDT) object