Your JSON is not valid! Try using a JSON linter to make sure you have the right syntax

I am using “send to an API”. I spent about 2 hours total working on this request. The body looked like (see first snippet). However after about an hour of troubleshooting. I was able to narrow it down to two fields that were causing the error, but I can’t tell why. I used about a dozen JSON validators, beautifiers, linters, and checkers… all of them gave me valid, 3 thumbs up, 6 stars. I even considered the possibility of hidden characters, left/right quotations etc ( I tried this tool, as well as a few others)

{
   "records":[
      {
         "fields":{
            "Order: Name":"{Order: Name}",
            "Order: Id":"{Order: Id}",
            "Order: Processed At":"{Order: Processed At}",
            "Order: Email":"{Order: Email}",
            "Line Items: Id":"{Line Items: Id}",
            "Line Items: Title":"{Line Items: Title}",
            "Line Items: Name":"{Line Items: Name}",
            "Line Items: Variant Id":[
               "{Line Items: Variant Id}"
            ],
            "Line Items: Quantity":
               "{Line Items: Quantity}",
            "Line Items: Vendor":"{Line Items: Vendor}",
            "Line Items: Fulfillment Service":"{Line Items: Fulfillment Service}",
            "Line Items: Product Id":[
               "{Line Items: Product Id}"
            ],
            "Line Items: Requires Shipping":"{Line Items: Requires Shipping}",
            "Line Items: Taxable":"{Line Items: Taxable}",
            "Line Items: Gift Card":"{Line Items: Gift Card}",
            "Line Items: Properties":"{Line Items: Properties}",
            "Line Items: Product Exists":"{Line Items: Product Exists}",
            "Line Items: Fulfillable Quantity":"{Line Items: Fulfillable Quantity}",
            "Line Items: Price":"{Line Items: Price}",
            "Line Items: Total Discount":"{Line Items: Total Discount}",
            "Line Items: Total Tax Lines":"{Line Items: Total Tax Lines}",
            "Line Items: Total Discount Allocations":"{Line Items: Total Discount Allocations}",
            "Line Items: Total Duties":"{Line Items: Total Duties}",
            "Line Items: Grams":"{Line Items: Grams}",
            "Line Items: Discount Allocations":"{Line Items: Discount Allocations}",
            "Line Items: Duties":"{Line Items: Duties}",
            "Line Items: Tax Lines":"{Line Items: Tax Lines}",
            "Line Items: Origin Location: Id":"{Line Items: Origin Location: Id}",
            "Line Items: Origin Location: Country Code":"{Line Items: Origin Location: Country Code}",
            "Line Items: Origin Location: Province Code":"{Line Items: Origin Location: Province Code}",
            "Line Items: Origin Location: Name":"{Line Items: Origin Location: Name}",
            "Line Items: Origin Location: Address1":"{Line Items: Origin Location: Address1}",
            "Line Items: Origin Location: Address2":"{Line Items: Origin Location: Address2}",
            "Line Items: Origin Location: City":"{Line Items: Origin Location: City}",
            "Line Items: Origin Location: Zip":"{Line Items: Origin Location: Zip}",
            "Order: Financial Status":"{}",
            "Order: Customer: Id":"{}",
            "Order: Customer: Orders Count":"{Order: Customer: Orders Count}",
            "Order: Customer: Total Spent":"{Order: Customer: Total Spent}",
            "Order: Customer: First Name":"{Order: Customer: First Name}",
            "Order: Customer: Last Name":"{Order: Customer: Last Name}",
            "Order: Customer: Email":"{Order: Customer: Email}",
            "Order: Customer: Accepts Marketing":"{Order: Customer: Accepts Marketing}",
            "Order: Customer: Created At":"{Order: Customer: Created At}",
            "Order: Customer: Updated At":"{Order: Customer: Updated At}",
            "Order: Customer: State":"{Order: Customer: State}",
            "Order: Customer: Last Order Id":"{Order: Customer: Last Order Id}",
            "Order: Customer: Verified Email":"{Order: Customer: Verified Email}",
            "Order: Customer: Tax Exempt":"{Order: Customer: Tax Exempt}",
            "Order: Customer: Last Order Name":"{Order: Customer: Last Order Name}",
            "Order: Customer: Currency":"{Order: Customer: Currency}",
            "Order: Customer: Accepts Marketing Updated At":"{Order: Customer: Accepts Marketing Updated At}",
            "Order: Customer: Admin Graphql Api Id":"{Order: Customer: Admin Graphql Api Id}",
            "Order: Customer: Default Address: Id":"{Order: Customer: Default Address: Id}",
            "Order: Customer: Default Address: Customer Id":"{Order: Customer: Default Address: Customer Id}",
            "Order: Customer: Default Address: First Name":"{Order: Customer: Default Address: First Name}",
            "Order: Customer: Default Address: Last Name":"{Order: Customer: Default Address: Last Name}",
            "Order: Customer: Default Address: Address1":"{Order: Customer: Default Address: Address1}",
            "Order: Customer: Default Address: Address2":"{Order: Customer: Default Address: Address2}",
            "Order: Customer: Default Address: City":"{Order: Customer: Default Address: City}",
            "Order: Customer: Default Address: Province":"{Order: Customer: Default Address: Province}",
            "Order: Customer: Default Address: Country":"{Order: Customer: Default Address: Country}",
            "Order: Customer: Default Address: Zip":"{Order: Customer: Default Address: Zip}",
            "Order: Customer: Default Address: Name":"{Order: Customer: Default Address: Name}",
            "Order: Customer: Default Address: Province Code":"{Order: Customer: Default Address: Province Code}",
            "Order: Customer: Default Address: Country Code":"{Order: Customer: Default Address: Country Code}",
            "Order: Customer: Default Address: Country Name":"{Order: Customer: Default Address: Country Name}",
            "Order: Customer: Default Address: Default":"{Order: Customer: Default Address: Default}",
            "Order: Created At":"{Order: Created At}",
            "Order: Updated At":"{Order: Updated At}",
            "Order: Number":"{Order: Number}",
            "Order: Token":"{Order: Token}",
            "Order: Gateway":"{Order: Gateway}",
            "Order: Test":"{Order: Test}",
            "Order: Total Weight":"{Order: Total Weight}",
            "Order: Taxes Included":"{Order: Taxes Included}",
            "Order: Confirmed":"{Order: Confirmed}",
            "Order: Cart Token":"{Order: Cart Token}",
            "Order: Buyer Accepts Marketing":"{Order: Buyer Accepts Marketing}",
            "Order: Landing Site":"{Order: Landing Site}",
            "Order: Checkout Token":"{Order: Checkout Token}",
            "Order: Customer Locale":"{Order: Customer Locale}",
            "Order: App Id":"{Order: App Id}",
            "Order: Browser Ip":"{Order: Browser Ip}",
            "Order: Client Details: Accept Language":"{Order: Client Details: Accept Language}",
            "Order: Client Details: Browser Height":"{Order: Client Details: Browser Height}",
            "Order: Client Details: Browser Ip":"{Order: Client Details: Browser Ip}",
            "Order: Client Details: Browser Width":"{Order: Client Details: Browser Width}",
            "Order: Client Details: User Agent":"{Order: Client Details: User Agent}",
            "Order: Order Number":"{Order: Order Number}",
            "Order: Discount Codes":"{Order: Discount Codes}",
            "Order: Note Attributes":"{Order: Note Attributes}",
            "Order: Payment Details: Credit Card Bin":"{Order: Payment Details: Credit Card Bin}",
            "Order: Payment Details: Avs Result Code":"{Order: Payment Details: Avs Result Code}",
            "Order: Payment Details: Cvv Result Code":"{Order: Payment Details: Cvv Result Code}",
            "Order: Payment Details: Credit Card Number":"{Order: Payment Details: Credit Card Number}",
            "Order: Payment Details: Credit Card Company":"{Order: Payment Details: Credit Card Company}",
            "Order: Payment Gateway Names":"{Order: Payment Gateway Names}",
            "Order: Processing Method":"{Order: Processing Method}",
            "Order: Checkout Id":"{Order: Checkout Id}",
            "Order: Source Name":"{Order: Source Name}",
            "Order: Tax Lines":"{Order: Tax Lines}",
            "Order: Contact Email":"{Order: Contact Email}",
            "Order: Order Status Url":"{Order: Order Status Url}",
            "Order: Billing Address: First Name":"{Order: Billing Address: First Name}",
            "Order: Billing Address: Address1":"{Order: Billing Address: Address1}",
            "Order: Billing Address: City":"{Order: Billing Address: City}",
            "Order: Billing Address: Zip":"{Order: Billing Address: Zip}",
            "Order: Billing Address: Province":"{Order: Billing Address: Province}",
            "Order: Billing Address: Country":"{Order: Billing Address: Country}",
            "Order: Billing Address: Last Name":"{Order: Billing Address: Last Name}",
            "Order: Billing Address: Latitude":"{Order: Billing Address: Latitude}",
            "Order: Billing Address: Longitude":"{Order: Billing Address: Longitude}",
            "Order: Billing Address: Name":"{Order: Billing Address: Name}",
            "Order: Billing Address: Country Code":"{Order: Billing Address: Country Code}",
            "Order: Billing Address: Province Code":"{Order: Billing Address: Province Code}",
            "Order: Shipping Address: First Name":"{Order: Shipping Address: First Name}",
            "Order: Shipping Address: Address1":"{Order: Shipping Address: Address1}",
            "Order: Shipping Address: City":"{Order: Shipping Address: City}",
            "Order: Shipping Address: Zip":"{Order: Shipping Address: Zip}",
            "Order: Shipping Address: Province":"{Order: Shipping Address: Province}",
            "Order: Shipping Address: Country":"{Order: Shipping Address: Country}",
            "Order: Shipping Address: Last Name":"{Order: Shipping Address: Last Name}",
            "Order: Shipping Address: Address2":"{Order: Shipping Address: Address2}",
            "Order: Shipping Address: Latitude":"{Order: Shipping Address: Latitude}",
            "Order: Shipping Address: Longitude":"{Order: Shipping Address: Longitude}",
            "Order: Shipping Address: Name":"{Order: Shipping Address: Name}",
            "Order: Shipping Address: Country Code":"{Order: Shipping Address: Country Code}",
            "Order: Shipping Address: Province Code":"{Order: Shipping Address: Province Code}",
            "Fulfilled By":"{Fulfilled By}",
            "Order#":
               "{Order#}"
            
         }
      }
   ]
}

When I removed these to lines, it worked, mind you I had to check each line until I found out where it was failing.

These are the two stinkers that took an hour of my life and gave me experience in exchanges

  1. “Line Items: Total Discount Allocations”:"{Line Items: Total Discount Allocations}",
  2. “Line Items: Discount Allocations”:"{Line Items: Discount Allocations}",
{
 	"records": [{
		"fields": {
			"Order: Name": "{Order: Name}",
			"Order: Id": "{Order: Id}",
			"Order: Processed At": "{Order: Processed At}",
			"Order: Email": "{Order: Email}",
			"Line Items: Id": "{Line Items: Id}",
			"Line Items: Title": "{Line Items: Title}",
			"Line Items: Name": "{Line Items: Name}",
			"Line Items: Variant Id": [
				"{Line Items: Variant Id}"
			],
			"Line Items: Quantity": "{Line Items: Quantity}",
			"Line Items: Vendor": "{Line Items: Vendor}",
			"Line Items: Fulfillment Service": "{Line Items: Fulfillment Service}",
			"Line Items: Product Id": [
				"{Line Items: Product Id}"
			],
			"Line Items: Requires Shipping": "{Line Items: Requires Shipping}",
			"Line Items: Taxable": "{Line Items: Taxable}",
			"Line Items: Gift Card": "{Line Items: Gift Card}",
			"Line Items: Properties": "{Line Items: Properties}",
			"Line Items: Product Exists": "{Line Items: Product Exists}",
			"Line Items: Fulfillable Quantity": "{Line Items: Fulfillable Quantity}",
			"Line Items: Price": "{Line Items: Price}",
			"Line Items: Total Discount": "{Line Items: Total Discount}",
   "Line Items: Total Tax Lines": "{Line Items: Total Tax Lines}",
			"Line Items: Total Duties": "{Line Items: Total Duties}",
			"Line Items: Grams": "{Line Items: Grams}",
			"Line Items: Duties": "{Line Items: Duties}",
			"Line Items: Tax Lines": "{Line Items: Tax Lines}",
			"Line Items: Origin Location: Id": "{Line Items: Origin Location: Id}",
			"Line Items: Origin Location: Country Code": "{Line Items: Origin Location: Country Code}",
			"Line Items: Origin Location: Province Code": "{Line Items: Origin Location: Province Code}",
			"Line Items: Origin Location: Name": "{Line Items: Origin Location: Name}",
			"Line Items: Origin Location: Address1": "{Line Items: Origin Location: Address1}",
			"Line Items: Origin Location: Address2": "{Line Items: Origin Location: Address2}",
			"Line Items: Origin Location: City": "{Line Items: Origin Location: City}",
			"Line Items: Origin Location: Zip": "{Line Items: Origin Location: Zip}",
   			"Order: Financial Status": "{}",
			"Order: Customer: Id": "{}",
			"Order: Customer: Orders Count": "{Order: Customer: Orders Count}",
			"Order: Customer: Total Spent": "{Order: Customer: Total Spent}",
			"Order: Customer: First Name": "{Order: Customer: First Name}",
			"Order: Customer: Last Name": "{Order: Customer: Last Name}",
			"Order: Customer: Email": "{Order: Customer: Email}",
			"Order: Customer: Accepts Marketing": "{Order: Customer: Accepts Marketing}",
			"Order: Customer: Created At": "{Order: Customer: Created At}",
			"Order: Customer: Updated At": "{Order: Customer: Updated At}",
			"Order: Customer: State": "{Order: Customer: State}",
			"Order: Customer: Last Order Id": "{Order: Customer: Last Order Id}",
			"Order: Customer: Verified Email": "{Order: Customer: Verified Email}",
			"Order: Customer: Tax Exempt": "{Order: Customer: Tax Exempt}",
			"Order: Customer: Last Order Name": "{Order: Customer: Last Order Name}",
			"Order: Customer: Currency": "{Order: Customer: Currency}",
   			"Order: Customer: Accepts Marketing Updated At": "{Order: Customer: Accepts Marketing Updated At}",
			"Order: Customer: Admin Graphql Api Id": "{Order: Customer: Admin Graphql Api Id}",
			"Order: Customer: Default Address: Id": "{Order: Customer: Default Address: Id}",
			"Order: Customer: Default Address: Customer Id": "{Order: Customer: Default Address: Customer Id}",
			"Order: Customer: Default Address: First Name": "{Order: Customer: Default Address: First Name}",
			"Order: Customer: Default Address: Last Name": "{Order: Customer: Default Address: Last Name}",
			"Order: Customer: Default Address: Address1": "{Order: Customer: Default Address: Address1}",
			"Order: Customer: Default Address: Address2": "{Order: Customer: Default Address: Address2}",
			"Order: Customer: Default Address: City": "{Order: Customer: Default Address: City}",
			"Order: Customer: Default Address: Province": "{Order: Customer: Default Address: Province}",
			"Order: Customer: Default Address: Country": "{Order: Customer: Default Address: Country}",
			"Order: Customer: Default Address: Zip": "{Order: Customer: Default Address: Zip}",
			"Order: Customer: Default Address: Name": "{Order: Customer: Default Address: Name}",
			"Order: Customer: Default Address: Province Code": "{Order: Customer: Default Address: Province Code}",
			"Order: Customer: Default Address: Country Code": "{Order: Customer: Default Address: Country Code}",
			"Order: Customer: Default Address: Country Name": "{Order: Customer: Default Address: Country Name}",
			"Order: Customer: Default Address: Default": "{Order: Customer: Default Address: Default}",
   			"Order: Created At": "{Order: Created At}",
			"Order: Updated At": "{Order: Updated At}",
			"Order: Number": "{Order: Number}",
			"Order: Token": "{Order: Token}",
			"Order: Gateway": "{Order: Gateway}",
			"Order: Test": "{Order: Test}",
			"Order: Total Weight": "{Order: Total Weight}",
			"Order: Taxes Included": "{Order: Taxes Included}",
			"Order: Confirmed": "{Order: Confirmed}",
			"Order: Cart Token": "{Order: Cart Token}",
			"Order: Buyer Accepts Marketing": "{Order: Buyer Accepts Marketing}",
			"Order: Landing Site": "{Order: Landing Site}",
			"Order: Checkout Token": "{Order: Checkout Token}",
			"Order: Customer Locale": "{Order: Customer Locale}",
			"Order: App Id": "{Order: App Id}",
			"Order: Browser Ip": "{Order: Browser Ip}",
   			"Order: Client Details: Accept Language": "{Order: Client Details: Accept Language}",
			"Order: Client Details: Browser Height": "{Order: Client Details: Browser Height}",
			"Order: Client Details: Browser Ip": "{Order: Client Details: Browser Ip}",
			"Order: Client Details: Browser Width": "{Order: Client Details: Browser Width}",
			"Order: Client Details: User Agent": "{Order: Client Details: User Agent}",
			"Order: Order Number": "{Order: Order Number}",
   			"Order: Note Attributes": "{Order: Note Attributes}",
			"Order: Payment Details: Credit Card Bin": "{Order: Payment Details: Credit Card Bin}",
			"Order: Payment Details: Avs Result Code": "{Order: Payment Details: Avs Result Code}",
			"Order: Payment Details: Cvv Result Code": "{Order: Payment Details: Cvv Result Code}",
			"Order: Payment Details: Credit Card Number": "{Order: Payment Details: Credit Card Number}",
			"Order: Payment Details: Credit Card Company": "{Order: Payment Details: Credit Card Company}",
			"Order: Payment Gateway Names": "{Order: Payment Gateway Names}",
			"Order: Processing Method": "{Order: Processing Method}",
			"Order: Checkout Id": "{Order: Checkout Id}",
			"Order: Source Name": "{Order: Source Name}",
			"Order: Tax Lines": "{Order: Tax Lines}",
			"Order: Contact Email": "{Order: Contact Email}",
			"Order: Order Status Url": "{Order: Order Status Url}",
   			"Order: Billing Address: First Name": "{Order: Billing Address: First Name}",
			"Order: Billing Address: Address1": "{Order: Billing Address: Address1}",
			"Order: Billing Address: City": "{Order: Billing Address: City}",
			"Order: Billing Address: Zip": "{Order: Billing Address: Zip}",
			"Order: Billing Address: Province": "{Order: Billing Address: Province}",
			"Order: Billing Address: Country": "{Order: Billing Address: Country}",
			"Order: Billing Address: Last Name": "{Order: Billing Address: Last Name}",
			"Order: Billing Address: Latitude": "{Order: Billing Address: Latitude}",
			"Order: Billing Address: Longitude": "{Order: Billing Address: Longitude}",
			"Order: Billing Address: Name": "{Order: Billing Address: Name}",
			"Order: Billing Address: Country Code": "{Order: Billing Address: Country Code}",
			"Order: Billing Address: Province Code": "{Order: Billing Address: Province Code}",
			"Order: Shipping Address: First Name": "{Order: Shipping Address: First Name}",
   			"Order: Shipping Address: Address1": "{Order: Shipping Address: Address1}",
			"Order: Shipping Address: City": "{Order: Shipping Address: City}",
			"Order: Shipping Address: Zip": "{Order: Shipping Address: Zip}",
			"Order: Shipping Address: Province": "{Order: Shipping Address: Province}",
			"Order: Shipping Address: Country": "{Order: Shipping Address: Country}",
			"Order: Shipping Address: Last Name": "{Order: Shipping Address: Last Name}",
			"Order: Shipping Address: Address2": "{Order: Shipping Address: Address2}",
			"Order: Shipping Address: Latitude": "{Order: Shipping Address: Latitude}",
   			"Order: Shipping Address: Longitude": "{Order: Shipping Address: Longitude}",
			"Order: Shipping Address: Name": "{Order: Shipping Address: Name}",
			"Order: Shipping Address: Country Code": "{Order: Shipping Address: Country Code}",
			"Order: Shipping Address: Province Code": "{Order: Shipping Address: Province Code}",
			"Fulfilled By": "{Fulfilled By}",
			"Order#": "{Order#}"
		}
	}]
}

I am curious if someone can tell me why.

I would also suggest you guys at the very least, provide the line or word where syntax is failing.

Hey @Dan_Valentine,

Did you receive any error codes from Airtable, or were you unable to run your flow due to invalid JSON? I tried to copy/paste the initial JSON into my flow, and it appears to be valid.

Any errors you received from Airtable may be due to the fact that those lines were mismatched from the data type your Airtable base was expecting.

For example, Airtable could be expecting a numeric value, but since those values are wrapped in quotes, it was passed as a text value.

Feel free to send us a link to your flow, and we can take a deeper look into it!

I ran this a couple days ago, and it worked a couple times…tonight it did not, and I got the same error… I like the theory that this is a data type mismatch. I’ll look into this, and if that’s the case I’ll report back.

This is a post request, so from what I understand the only to see if it’s a valid is to actually run the workflow.

I didn’t make any changes to the body, and it worked once, than it didn’t work…

This is how the error is displaying…

Validators/Lintors love it… even parabola seems okay with it, until it’s run.
This is the flow

Hi @Dan_Valentine - It could also be that there are invalid invisible characters or characters that need to be escaped in the actual Shopify data. One easy thing you can try is to place a Clean data step in between the Pull from Shopify step and the Send to an API step.

You’ll want to clean the data in All Columns and select the cleaning option to “Clean to use as JSON”.

Let us know if that works!

Cleaning worked!

I cleaned for JSON. Thank you!

Article edit suggestion… where it says " If you encounter a JSON error when sending data to an API" maybe list “Your JSON is not valid! Try using a JSON linter…” error as an example for SEO sake

1 Like