Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


jrtwynam
2019-03-27T17:15:25Z
Hi,

I'm trying to create a user-readable report from some JSON output. The JSON is obtained by accessing our software provider's API, and it pulls a list of outstanding orders that we need to fulfill. This is a sample of the JSON:


{
  "status": "success",
  "count": 1,
  "code": 200,
  "results": [
    {
      "account_id": 123456789,
      "required_ship_date": "2019-03-08 00:00:00",
      "line_items": [
        {
          "updated_at": "2019-03-07 17:45:43",
          "id": 266467968,
          "sku": "test-sku",
          "price": "0.99",
          "barcode": "0123456789123",
          "name": "Test Product",
          "large_thumbnail": "",
          "partner_line_item_id": "MO3-282168325",
          "created_at": "2019-03-06 18:49:57",
          "quantity_allocated": 1,
          "quantity_pending_fulfillment": 1,
          "fulfillment_status": "pending"
         }
      ],
      "order_number": "MO3"
    }
  ]
}


In this particular example, there's only 1 order with 1 order line. However, there could be multiple orders, each with multiple order lines. The JSON has a "count" parameter near the top that says there was 1 order returned, so I had thought about using the JSON Filter task to read that value and loop through to pull out other values using other JSON filters with paths similar to results[0].line_items[0].sku, and creating an HTML table that can be dumped into the body of an email. The problem I'm having is that each order doesn't have a count of order lines. My initial loop would be a "for 0 to (count - 1)" to loop through the orders, but each order needs an inner loop to loop through the order lines. First of all, I don't think that VC handles nested loops, but even if it did, how would I tell it "for each order line within this order"?

I had also thought about writing some C#.net code to handle this, but it seems to me that it should be something that's do-able with VC's built in JSON filter task.

Thanks.
Sponsor
Forum information
Support
2019-03-31T13:35:50Z
VC Tasks can be used to find a certain node but not loop through - at the moment. I am moving this topic to Feature requests forum.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
David A
2019-11-27T20:14:04Z
Originally Posted by: Support 

VC Tasks can be used to find a certain node but not loop through - at the moment. I am moving this topic to Feature requests forum.



+1 this request
CarstenLM
2022-05-09T08:56:57Z
Did this ever become a request?

If not +1, I've got trustpilot reviews in JSON i'd like to loop through 😃
Scroll to Top