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:
Where the task output is the output from a Net task that points to a web API URL. This gives me this error:
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.