Scenario - I have arrays that I would like to store in a json array to be able to post.
Array values can be seen in image attached. I have a set of companyids in an array, the number of companyids may not always be two. So with a for each activity based on the number of companyids this will determine the iteration count. The issue I’m facing is that with after every iteration the previous values are overridden. Is there a way to store the value so the final json array looks like the below image. I’ve attached images of array values, activities and the intended output for json array.
The reason JArray values getting replaced is you need to append Jarray values into a list before adding them into “InsuredCompanyInfo” key.
I tried a backtracking approach, refer attached. Here I created your expected post Json object quick and fast with respective to CompanyId array’s length using for each and vb.net.