Below is an example of how to set up a JSON mapping for a HTTP(S) import that is coming from a NetSuite saved search.
A {{#if @last}}{{else}},{{/if} statement was also added so that as long as it isn't the last element of the array, it will add a comma. This is because JSON arrays must be separated with a comma, but it can't be there as the last element.
{
"UnitycartOrderPost": {
"ClientName": "test",
"ClientCode": "testcc",
"Test": "y",
"Order": [
{{#each data}}
{
"Subtotal": "0.00",
"Total": "0.00",
"ExternalID": "{{0.id}}",
"AdCode": "iPost",
"ShipFirstname": "Test",
"ShipLastname": "Fufillment",
"ShipAddress1": "{{0.[Shipping Address 1]}}",
"ShipCity": "{{0.[Shipping City]}}",
"ShipState": "{{0.[Shipping State/Province]}}",
"ShipZip": "{{0.[Shipping Zip]}}",
"ShipPhone": "",
"Email": "{{0.[Customer Email]}}",
"UseAsBilling": "y",
"PaymentType": "5",
"Items": {
"Item": [
{{#each this}}
{
"Inv": "{{Item}}",
"Qty": "{{Quantity}}",
"PricePer": "{{Amount}}",
"NumOfPayments": "1"
}{{#if @last}}{{else}},{{/if}}
{{/each}}
]
}
}{{#if @last}}{{else}},{{/if}}
{{/each}}
]
}
}
Sample Mapping
Sample Data
Comments
0 comments
Please sign in to leave a comment.