Json Collection Serialization property

Official Content
This documentation is valid for:
Specifies the way collections are serialized in Json format.

Values

Sequence Serializes as a plain sequence of collection elements.
Wrapped Includes the collection name item. This is the default value.

Scope

Objects: Structured Data Type
Level: SDT level node

Description

Important: This property is taken into account only when the SDT is a parameter of an API object. It is not taken into account in procedures or data providers exposed as REST.

Samples

A Structured Data Type is defined as follows: 

Countries  Is Collection = True
       CountryName     Character

It is using an API object:

[RestVerb(GET)]
    ListCountries(out:&Countries) => ListCountries(&Countries);
 

Where ListCountries procedures is defined in this way:

Parm(out:&Countries)

&country = new()
&country.CountryName = "UY"
&Countries.Country.Add(&country)

&country = new()
&country.CountryName = "BR"
&Countries.Country.Add(&country)

It could be serialized as follows:

  • Wrapped:
  {"Countries": [{"CountryName": "UY"},{"CountryName": "BR"}]}
  • Sequence:
[{"CountryName": "UY"},{"CountryName": "BR"}]

Availability

This property is available since GeneXus 17 upgrade 4.