Choose where you’d like to start

toCollection

Overview

The toCollection function takes an expression as an argument, and returns a collection.

Return Type

  • COLLECTION

Syntax

<variable> = <expression>.toCollection();

where,

ParameterData typeDescription
<variable>COLLECTIONThe variable which will contain the converted collection.
<expression>TEXTThe text that needs to be converted to a collection.

Note:

  • If the text contains key-value pairs, the collection behaves like a map.
  • If the text contains values, other than key-value pairs, the collection behaves like a list.
  • This function can act on map and list datatypes alsoand convert them into a collection

Examples

 products =  "{company:Zoho, product:Deluge}";
 info products.toCollection(); // Returns the collection as a key-value pair - {"product":"Creator","company":"Zoho"}
 products =  "{company, Zoho, product, Deluge}";
 info products.toCollection(); // Returns the collection as a list - "product,Creator,company,Zoho"

Get Started Now

Execute