Community forum

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


Lasse Lehtinen
2014-01-28T10:16:29Z
Would it possible that in some point VisualCron would be able to parse JSON responses? I can already send queries with Net -> HTTP but parsing the queries is not that feasible with current tools. I would not need complex queries like in Xpath, but just looping and picking values from certain keys.
Sponsor
Forum information
Support
2014-01-28T10:24:09Z
Sounds interesting. Any details on how you would like it to work?
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Lasse Lehtinen
2014-01-28T15:31:29Z
I can already make a query through HTTP but I would easily like to parse the JSON. I know that there is no direct XPath equilevant in JSON, but you could implement something like this that would "emulate" XPath queries, like JSONPath. So the Task would be something like:

Net -> HTTP
JSON -> Read node
bweston
2014-01-29T18:45:53Z
As a temporary workaround in the absence of this feature, Powershell works pretty well with JSON. You might be able to make a pretty simple Powershell task that would convert the JSON output into something the following VisualCron tasks could consume more easily.

This would still be a neat feature to have, though, if a good implementation for it can be determined.
Support
2017-09-29T14:45:21Z
We have added a JSON Task that supports JSONPath and JQ filters. There is also a Variable function that supports both. You can test it in this build;

https://www.visualcron.c....aspx?g=posts&t=7604 
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
jrtwynam
2019-03-20T17:06:57Z
Hi,

I'm trying to figure out a way to convert a JSON string to CSV, but I'm having trouble with the JSON Filter task and variable. This is some of the JSON that's returned from a web API:

{"status": "success", "code": 200, "products": [{"final_sale": false, "ignore_on_invoice": false, "reserve_inventory": 0, "account_id": 4193, "weight": 0.0031, "dropship": false, "updated_at": "2019-03-04T19:13:18", "price": 38.6900, "barcode": "264277401", "kit_build": false, "value_currency": null, "images": [{"url": "", "sort": 85}, {"url": "", "sort": 85}, {"url": "", "sort": 85}], "height": 0E-8, "customs_description": null, "kit_components": [], "customs_value": 0.0000, "value": 0.0000, "active": true, "tariff_code": "8708.30.50", "kit": false, "id": 282806672, "option": " ", "sku": "70003872-A1C-1704-184130", "no_air": false, "name": "Disc Brake Caliper-Friction Choice Caliper Front Right Cardone 18-4130 Reman", "country_of_manufacture": "", "warehouses": [{"available": 7, "inventory_bin": "1120-22E02", "sell_ahead": 0, "name": "Disc Brake Caliper-Friction Choice Caliper Front Right Cardone 18-4130 Reman", "purchase_orders": [], "allocated": 0, "value_currency": null, "value": 0.0000, "warehouse_id": 7391, "price": 38.6900, "active": true, "customs_value": 0.0000, "inventory_overstock_bin": " ", "backorder": 0, "warehouse": "Primary", "reserve_inventory": 0, "on_hand": 7, "id": 282806672}], "product_note": null, "do_not_count": false, "created_at": "2019-03-04T19:05:30", "tags": [], "brand": null, "virtual": false, "custom": false, "width": 0E-8, "length": 0E-8, "ignore_on_customs": false, "weight_in_oz": 0.05000000, "reorder_level": 0, "thumbnail": "", "reorder_amount": 1}, {"final_sale": false, "ignore_on_invoice": false, "reserve_inventory": 0, "account_id": 4193, "weight": 0.0031, "dropship": false, "updated_at": "2019-03-04T19:13:18", "price": 41.3900, "barcode": "264278320", "kit_build": false, "value_currency": null, "images": [{"url": "", "sort": 85}, {"url": "", "sort": 85}, {"url": "", "sort": 85}], "height": 0E-8, "customs_description": null, "kit_components": [], "customs_value": 0.0000, "value": 0.0000, "active": true, "tariff_code": "8708.30.20", "kit": false, "id": 282806808, "option": " ", "sku": "70003873-A1C-1704-184131", "no_air": false, "name": "Disc Brake Caliper-Friction Choice Caliper Front Left Cardone 18-4131 Reman", "country_of_manufacture": "", "warehouses": [{"available": 7, "inventory_bin": "1136-15F10", "sell_ahead": 0, "name": "Disc Brake Caliper-Friction Choice Caliper Front Left Cardone 18-4131 Reman", "purchase_orders": [], "allocated": 0, "value_currency": null, "value": 0.0000, "warehouse_id": 7391, "price": 41.3900, "active": true, "customs_value": 0.0000, "inventory_overstock_bin": " ", "backorder": 0, "warehouse": "Primary", "reserve_inventory": 0, "on_hand": 7, "id": 282806808}], "product_note": null, "do_not_count": false, "created_at": "2019-03-04T19:05:30", "tags": [], "brand": null, "virtual": false, "custom": false, "width": 0E-8, "length": 0E-8, "ignore_on_customs": false, "weight_in_oz": 0.05000000, "reorder_level": 0, "thumbnail": "", "reorder_amount": 1}, {"final_sale": false, "ignore_on_invoice": false, "reserve_inventory": 0, "account_id": 4193, "weight": 0.0031, "dropship": false, "updated_at": "2019-03-04T19:13:27", "price": 24.3400, "barcode": "264240279", "kit_build": false, "value_currency": null, "images": [{"url": "", "sort": 85}, {"url": "", "sort": 85}, {"url": "", "sort": 85}], "height": 0E-8, "customs_description": null, "kit_components": [], "customs_value": 0.0000, "value": 0.0000, "active": true, "tariff_code": "8708.30.20", "kit": false, "id": 282767870, "option": " ", "sku": "70003892-A1C-1704-184146", "no_air": false, "name": "Disc Brake Caliper-Friction Choice Caliper Front Right Cardone 18-4146 Reman", "country_of_manufacture": "", "warehouses": [{"available": 1, "inventory_bin": "1135-27C05", "sell_ahead": 0, "name": "Disc Brake Caliper-Friction Choice Caliper Front Right Cardone 18-4146 Reman", "purchase_orders": [], "allocated": 0, "value_currency": null, "value": 0.0000, "warehouse_id": 7391, "price": 24.3400, "active": true, "customs_value": 0.0000, "inventory_overstock_bin": " ", "backorder": 0, "warehouse": "Primary", "reserve_inventory": 0, "on_hand": 1, "id": 282767870}], "product_note": null, "do_not_count": false, "created_at": "2019-03-04T19:05:30", "tags": [], "brand": null, "virtual": false, "custom": false, "width": 0E-8, "length": 0E-8, "ignore_on_customs": false, "weight_in_oz": 0.05000000, "reorder_level": 0, "thumbnail": "", "reorder_amount": 1}], "results": 3}


That's for 3 products, but eventually I'd like to get this pulling around 600 to 700 products, so the JSON code will be much longer. My problem is that I don't want to search for a particular value within this string, I want it to convert the entire string to a CSV file. I tried using the JSON Filter variable like this:

{JSON(Filter|JSONPath|{TASK(a787bfed-85e2-407f-9cce-a39b6e3d2a99|StdOut)}|products|JSON|;)}


Where the task output is the output from a Net task that points to a web API URL. This gives me this error:

Variable 'CSV' was updated to: 'TranslateVariables->Unhandled error: Error reading JToken from JsonReader. Path '', line 0, position 0. on string: {JSON(Filter|JSONPath||products|JSON|;)}'


I get a similar error when trying to use the JSON Filter task. I've also tried using a .NET task to use some C# code to convert it, but my C#.net coding skills are almost non-existent so I was relying on code that I found online, none of which worked.

Does anyone have any thoughts on how I can accomplish this?

Thanks.
Scroll to Top