cancel
Showing results for 
Search instead for 
Did you mean: 

Best way to read the data from JSON list and process it one by one to a rest call

akarsh
New Contributor III

I have a input json file like below please see the dummy example below

{ "totalCount": 2, "dataList": [ { "IFA": "IFA1", "voltage": "200", "power": "100", "equipid": "1234ABC", "SN": "SalesForce-1" }, { "IFA": "IFA2", "voltage": "200", "power": "100", "equipid": "1234ABC", "SN": "SalesForce-1" } ] }

I have to read this file and process the Items one by one. 
First I have to get the IFA number and then do Salesforce lookup to get the Id from sales force .

Then the output Id from the salesforce should be mapped to accountID  field and this along with other data in the file should be passed to SalesForce upsert snap.

can anyone help me on how to do this? I am new to snaplogic

1 ACCEPTED SOLUTION

SpiroTaleski
Valued Contributor

@akarsh 

You just need to split the array using the JSON Splitter Snap, once you read the file and parse the content, so you will have the nested structure split and pipeline will process the records one by one. Then you can proceed with developing the rest of the logic.

Note: You should use REST API Mode within the Salesforce Snaps, in order records to be processed one by one. 

View solution in original post

5 REPLIES 5

akarsh
New Contributor III

As mentioned above 

I have a input json file like below please see the dummy example below

{ "totalCount": 2, "dataList": [ { "IFA": "IFA1", "voltage": "200", "power": "100", "equipid": "1234ABC", "SN": "SalesForce-1" }, { "IFA": "IFA2", "voltage": "200", "power": "100", "equipid": "1234ABC", "SN": "SalesForce-1" } ] } 

this will be split using json splitter and sent to salesforce through API which returns an output.

Output from salesforce will be like this

[{"assetguid":"test","sfdcid":"id","status":"SUCCESS","updatedTime":"2023-11-24T08:59:34.167Z"}]

I want to collect these output in single file as you mentioned I tried Group By N but it doesn't return any output. 

my group by n snap looks like this

akarsh_0-1700821147104.png

as you can see group by n got 2 documents but there was not output

akarsh_1-1700821186299.png

can you please help me here? what am I doing wrong here?