K2 Five: How to use Serialize List to Array

  • 26 April 2021
  • 4 replies
  • 223 views

I have a list view and want to pass only selected records from this list to a REST endpoint which accepts them as a JSON array.

Therefore, I am exploring Serialize List to Array methods. Is my case a fit for using this method? Can some please share an example using this method? I am not clear how to prepare Serialized List as input from the List View?

 

https://help.nintex.com/en-US/k2five/devref/current/default.htm#SBrokers/SB-Serialization.htm

 

Thanks!


4 replies

Hi,


I have recently done this in K2 Five.


 


Logic


I loop through rows on the List View and use the Serialize Add Item To Array method:



I guess in your scenario you only want selected rows so you would need to do something like this:



 


Important: You will need to have a Data Label to store the Serialized Array.



  • You will use this as an input parameter

  • You will also use this to store the output (after updating it with the current row).


 


Input



Output



 


Advanced SmartObject


Of course in order to do this, your Advanced SmartObject needs to expose the method:



You will see the property that we referenced earlier below:



 


If you need assistance setting up the SmartObject, I would suggest watching the K2 tutorial as it covers aspects of serialization (link at bottom of page).


 


I am at the point where I am now trying to do the opposite, rather than submitting to a POST endpoint, I am trying to display complex data from a GET endpoint. My challenge is that I have lists within lists, and I want to display the data using List Views but I do not want to store it first (unless I have to).


 


If you are interested, my post is here: https://community.nintex.com/t5/K2-Five-Forum/Displaying-Deserialised-Typed-Array-on-a-List-View-or-Form/td-p/202419


 


Hope this helps, if you have managed to display List Data from a REST call on a List View, without storing any data, please let me know!


 


Thanks

Thanks @ConradMc 


I am aware how to use "Serialize Add Item to Array" but I was actually asking about another method "Serialize List to Array". Do you know how to use that?

No, I couldn't get it to work properly. I found a blog elsewhere which suggested to use the Add Item to Array instead.

Badge +3

I know this has been a while but it was the top result when searching "Serialize list to Array". 


I did some digging and found the following that (finally) explains what it does:


https://silo.tips/download/endpoint-broker-deep-dive


In case the link is no longer available, this is the area describing this method.



 


 

Reply