How to filter fields in the JSON importer?
JSON importer allows you to filter fields that you can import to the destination file. The most common questions about filtering are:
- How to define the field name?
- Does Coupler.io support nested field filtering?
Let us answer both of them with an example.
Here is the original JSON response that is returned by API:
[ { "Cmf":"76013791", "ROHeaderID":111111, "CommonInvoiceID":111111, "CustID":111111, "datein":"2020-05-14T00:00:00", "ServiceWriterName":"JOHN DOE", "ServiceWriterUserName":"Service Name", "totalowed":1409.62, "Unit":[ { "DealerId":"", "ROUnitID":111111, "VIN":"1122334455667", "Make":"POLARIS", "Model":"R150LUTV", "Year":"2018", "Job":[ { "DealerId":"", "ROJobID":44556677, "JobDescription":"Some sample description", "JobTitle":"REPAIR", "InternalJob":0, "WarrantyJob":0, "ShopSupply":10.15, "Labor":[ { "DealerId":"", "ROLaborID":26871629, "JobDescription":"REPAIR", "Hours":1.0, "Rate":145.0, "Total":145.0, "Actualhours":0.0, "TechnicianName":"MARK DOE", "technicianid":"MD", "jobcode":"DONE", "DiscountTotalCharge":145.0, "TotalCharge":145.0, "technicianrate":0.0, "closetime":"1000-01-01T00:00:00" } ] } ] } ] } ]
In case you import this JSON without fields filtered, you get the following headers' names in the destination file:
You can copy values like "CustID", "totalowed" with no changes and Coupler.io will define the needed field properly. To filter a field, you need to copy the header name from the destination file and paste it to the "Fields" field in the importer settings.
However, you will need to adjust the name of the header for the "Unit.Model" field, because in the JSON structure "Unit" is an array that contains only one element, so Coupler.io prettifies naming. To use all fields that are nested in the "Unit" element, you will need to add "0" after the "Unit" name, and the field name will look like "Unit.0.Model" or "Unit.0.Job.0.Labor.0.TotalCharge":
As a result, you will get only defined columns in the destination file: