Using MAPKEYS()

You can make use of the MAPKEYS function to Map a new header or key name to the default header or key name of an array of JSON objects for data fetched from various resources.

Syntax

MAPKEYS([ArrayOfJsonobjects.Key1,ArrayOfJsonobjects.Key2,…],“newkeyname1,newkeyname2,…”)

Or,

MAPKEYS([ArrayOfJsonobjects.Key1,ArrayOfJsonobjects.Key2,…],“newkeyname1:Key1,newkeyname2:Key2,…”)

Or

MAPKEYS([ArrayOfJsonobjects.Key1,ArrayOfJsonobjects.Key2,…],“Key1 AS newkeyname1, Key2 AS newkeyname2, …”)

Where,

  • newkeyname<1>: is the new header label;
  • key<1>: is the header label of the fetched data and in the order, it is fetched.

Moreover, the order of the keys or columns would be the same as the order in which you have fetched them. However, if you want to reorder it when displaying data in the list controls like Tablegrid, you can change the order in the MAPKEYS function and the data would be presented accordingly.

Now let us take an example to fetch data from a Sheet using a LOOKUP function and display it in a Tablegrid control.

The LOOKUP function would be written as shown in the example below and the output would have the Header Labels for each array of JSON objects as seen in the Header Label section.

Now using MAPKEYS() we are mapping new keys to each of the key values and reordering them as well in this example below.