January 26, 2021, 3:20am
I am using
Deserialize Json activity to parse the JSON received from an API,
FileTest.json (1.7 KB)
‘Deserialize JSON’ activity
output ( jsonObject):
I’m trying to iterate each field by using “For Each”, assigning each field value to a variable…
… and finally, send each variable to the Data Table:
But the “For Each” activity fails,
Debugging, I found this in JsonObject…so I guess I’m using the wrong format to retrieve items in the “ForEach” activity…
Any idea to solve this?
January 26, 2021, 3:25am
Perhaps, you need to create DataTable instance for OutPutData in advance using Build DataTable activity, for example. Can you try it?
January 26, 2021, 3:28am
Thanks, I already did it, I have updated the post with the screenshot… So that’s not the issue
January 26, 2021, 3:43am
Can you share your json string as a file, if possible? It’s no problem even if dummy data.
January 26, 2021, 4:06am
Thank you for sharing your data. How about the following sample?
Sample20210126-1.zip (3.5 KB)
January 26, 2021, 4:43am
@Yoichi , It perfectly works with the file as Input,
I’m now testing with the API, the response is huge then the bot is taking a lot of time to process the records but at least it hasn’t failed…
I’m worried because in Production I need to process 160K records (29 fields each one), so maybe I will need to find other options to improve the performance
January 26, 2021, 4:54am
@Yoichi it works! Thank you,
The bot was able to process 1000 records (
29fields each record) in 15 minutes. I will investigate how to refactor your solution to process 160K, I just need it for the first Full Load, later I will use Deltas to update/process new records daily
January 26, 2021, 5:00am
We might be able to achieve it using Regex, if there aren’t Name, Label and Value elsewhere and its order is always same. (Probably it’s faster than using deserialize json and loop).
Can you try the following?
Sequence.xaml (8.3 KB)
January 26, 2021, 5:34am
@Yoichi With Regex was almost the same, 14 minutes for 1000 records.
January 26, 2021, 5:54am
Thank you for trying. For Each and AddDataRow might be slow.
I’ve rewrite the above with Invoke Code as the following. Can you try this?
Sequence.xaml (10.0 KB)
Note: Can you try just “run file” (not debug) If you ran debug mode, because it’s very slow.
January 27, 2021, 2:22am
@Yoichi I have just tested it, and it was completed in 4 minutes! Thank you so much for all your help!
January 30, 2021, 2:22am
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.