Business Component FromJson method

Official Content
This documentation is valid for:

Loads a variable based on a Structured Data Type (SDT) from a JSON string received as a parameter.

Syntax

[&Boolean =] &SDT.FromJson(&String[, &Messages])

Where:
&String: 
    Attribute or variable string with the JSON content.

&SDT:
    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. 

Scope

Objects: ProcedureTransactionWeb Panel, Panel
Generators: GeneXus .NET Framework generator .NET, GeneXus Java Generator

Description

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.

Technical Details

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:

References

See Also

ToJson Method
Structured Data Type (SDT) object