JSON
Extract List
11 min
the extract list action is one of the actions at your disposal to work with json data extract list enables you to extract a list of values from a json or a json array the action will be able to query/extract data from a json input using a jsonpath expression and save it to a variable extract list was previously called json mapper to list overview the action is used to filter the json data that we will import in our process for future use input field 1 βinput jsonβ input your json object / array or a data model input field 2 βqueryβ the input jquery expression for obtaining the desired key value of your json input output field "output" returns a list of values corresponding to the jquery expression how to the variables need to be adjusted according to your expected result for each process example 1 1\ create a new process and give it a name 2\ drag the extract list action to the canvas and link it to the other actions 3\ add the needed variables <%jsonin%> <%jsonin%> will contain the json data, the default will use the variable will be of type json, single value { 	"store" { 	 "book" \[ 	 { 	 "category" "reference", 	 "author" "peter mark roget", 	 "title" "rogets 21st century thesaurus", 	 "price" 8 74 	 }, 	 { 	 "category" "fiction", 	 "author" "melanie finn", 	 "title" "the hare", 	 "price" 12 89 	 }, 	 { 	 "category" "fiction", 	 "author" "kristin hannah", 	 "title" "the four winds", 	 "isbn" "0 573 21321 3", 	 "price" 8 69 	 }, 	 { 	 "category" "fiction", 	 "author" "lauren oyler", 	 "title" "fake accounts", 	 "isbn" "0 698 19225 3", 	 "price" 21 39 	 } 	 ], 	 "bicycle" { 	 "color" "blue", 	 "price" 19 65 	 } 	} } <%filter%> <%filter%> will contain the jquery expression that we will use in order to extract from the json input data the variable will be of type string and single value the query will retrieve the last book in order (notice that the result of the query will be a list with one value) this is the filter for obtaining the last book $ book\[ 1 ] <%result%> <%result%> will be our actions output the variable will be a list of type json 4\ click the extract list action to access its configurations and add the variables created at the previous space 5\ save , validate and run the process 6\ the process will ask for the inputs, we could leave the defaults as is for now 7\ click run 8\ click check instance to view the results further queries we will continue with further examples of queries by only changing the <%filter%> <%filter%> and showcasing the returned results for the same json input, below the examples <%filter%> <%filter%> will use $ book\[0,1] to obtain the first two books <%filter%> <%filter%> will use $ book\[?(@ isbn)] to filter all books with isbn number <%filter%> <%filter%> will use $ book\[?(@ price<10)] to filter all books cheaper than 10 example 2 https //kb procesio com/regex replace#qd how to https //docs procesio com/merge lists#q how to 1\ create a new process and give it a name 2\ drag the extract list action to the canvas and link it to the other actions 3\ add the needed variables <%input%> <%input%> will contain the json data, the default will use the variable will be of type json, single value \[ { "name" "eric", "invoicenumber" "inv99901", "duedate" "2021 08 30t07 00 00 000z", "amount" 122 45, "phonenumber" "0700000000", "emailaddress" "employee\@procesio com" }, { "name" "chris", "invoicenumber" "inv99902", "duedate" "2021 08 03t07 00 00 000z", "amount" 144 99, "phonenumber" "0711111111", "emailaddress" "otheremployee\@procesio com" }, { "name" "diana", "invoicenumber" "inv99903", "duedate" "2021 08 30t07 00 00 000z", "amount" 99 99, "phonenumber" "0722222222", "emailaddress" "employee\@procesio com" } ] <%filter%> <%filter%> will contain the jquerry expression that we will use on our data the variable will be of type string and single value in this case name <%result%> <%result%> will be our actions output 4\ click the extract list action to access its configurations and add the variables created at the previous space 5\ save , validate and run the process 6\ the process will ask for the inputs, we could leave the defaults as is for now 7\ click run 8\ click check instance to view the results we will see that all first names from the json were saved in the variable