How to build a JSON

  • 22 August 2019
  • 5 replies
  • 4 views

Userlevel 4
Badge +10

Hi everyone,

 

I use nintex Xtension to interact with Google Sheet V4 API.

In the body request I need to send JSON structure, but I don't know how to Build a JSON.

The structure that I want to build is a json multi dimensional array, (an Array of Array).

For exemple : 

[["Val1.1","Val1.2],["Val2.1","Val2.2"]]

In the action "Add item to collection" we can't add collection, only text, int...

 

anyone knows how to achieve this ?


5 replies

Userlevel 6
Badge +22
Hi,
Could you use a combination of Build String actions and maybe regular expressions to create the string and just put it into a text variable?
Userlevel 4
Badge +10

Hi, No I can't, because if I store my JSON value in a string variable when the query is sent, the body value is transformed as a string and not array, and I get an error because I pass an array who contains string value and not an Array who contains Array Who contains string value.

 

For exemple, my array is called "values" and I put my JSON array as string in it, the query will be 

"body": {"values":["[""test1"
Badge +17

Pinging @sean_fiene on this to see if he has any thoughts about it.

Badge +8

Was there any additional information to this @nico @eharris04 as I'm running into the same issue.

Userlevel 4
Badge +10

for the moment no, there is no change, it is impossible to build complex objects with Xtension. But, normally, this is planned in a future version.

 

I success to make API calls with complex objects (for me it's the Google Sheet API) by simply using the "Call Web Service" action and set all the Header and body. (Make several calls to get the authentication token and then make the API calls)

Reply