resource efficient way to use of variables that depend upon each other that refer to long JSON paths

Certified Associate Developer

Hi community,

I am wondering how the following use case will affect recourses and/or if there is a better way to approach it.
I have to fetch several date from a JSON respons where the data I need is stored in multiple and long JSON paths, some 8 levels deep.
there is some kind of root path to begin with that starts with the local variable that contains the total respons.

e.g. local!totalRespons.result.body.serverInfo (root path)

then refer to this root using a local variable named local!root.

then the response has two main "branches" person and company. 

So I could make two variable local!person: local!root.person. and local!company: local!root.company.

I can continue to define the local variables this way multiple levels deep.

This way in my opinion the code is easy to read and is easer to fetch data using short paths, same reason for using dot notation opposed to using index .
But in this approach all this variables depend upon each other but the values all depend on the initial response and no data is altered.

I could also define a variable for every field of data I need by define that variable using the full path.
e.g. local!companyEmail: local!totalRespons.result.body.serverInfo.company.contactInfo.item.email.In total I have to fetch and store data in 15 variables. The expression that calls the Api with the response will be called about 250 times one by one looped in the process model.  

What approach would you recommend?

Kind Regards,

Erik

  Discussion posts and replies are publicly visible