Native complex value

◷ Reading Time: 3 minutes

Native Complex Value is a representation of hierarchical values. Since v7 of FlexRule you can define array (or collections) using [ and ]. Also you can define key/value pairs using { and }.

The combination of using a native array and key/value pairs allows you to define complex hierarchical values.

Key Value Pair

To define a key-value pair follow the below format:

Format: { name: value }
  • name: defines key name. can be enclosed with single/double quotes (‘ or “) if it includes spaces.
  • value: defines a value as a valid FlexRule expression


{Name: 'Arash', Family: 'Aghlara'}


Native array supports simple values and Native complex values by separating them with a comma (,) and putting the between [ and ].

[1,3,'testing string', #2010/1/1#]

or for native complex values:

   {Name: 'Arash'}, 
   {Name: 'Goli'},
   [10, 20, 30],

As you see in the above example, they can be nested and contain other native complex values.


A JSON can be consider a simple form of a native complex value. This capability allows FlexRule to understand JSON objects natively.

   Name: 'Arash', 
   Family: 'Aghlara',
   Company: {
       Name: 'FlexRule',
       FoundedAt: 2008

Complex Value

One of the benefits of native complex value is it allows you to have an extended, dynamic hierarchical values, which opposite to JSON, it does not limit you only on the JSON standard (supported) value types:

  • Support richer value types in the hierarchy (i.e. DataTime, Timespan…)
  • Support variables as part of the hierarchy
  • Support computational values for the values in the hierarchy
   CreatedAt: now(),
   Name: n,
   Address: {
        Line1: address.Line1
   IsValid: n!=null and a>0 and address.Line1!=null,
   Birthday: #1967/12/27#

In the above example; n and address are the defined parameters of logic. now() is a valid defined function in FlexRule. And Birthday value is a valid DateTime expression in FlexRule. And IsValid value is computed based on some other parameters.

Updated on October 30, 2023

Was this article helpful?

Related Articles