Ad

"Unexpected Token } In JSON" (Firestore Connecting Through Zapier)

Attempting to hook up a trigger from Zapier when a Firestore document gets added, Zapier asks for an orderBy element. Documentation (https://zapier.com/help/firebase/#creating-a-firestore-structured-query-for-a-trigger) seems pretty straightforward, but I get an error that

ERROR: We had trouble finding a sample. The specified query does not contain valid JSON. Unexpected token } in JSON at position 123

I tried a couple of variations (see below for 2 examples), but I keep getting the same error each with a different position. enter image description here "orderBy": [{ "field": { "fieldPath": "timestamp" }, "direction": "DESCENDING" }], (Result: Position 123)

"orderBy": [{
  "field": "timestamp,
  "direction": "DESCENDING"
}],
(Result: Position 46)

I'm not even sure where Zapier is getting the JSON, so I can't look at the JSON to see if anything is funky.

Does anyone know how to fix, or at least how to view the full JSON file?

Ad

Answer

The issue is the trailing comma after the last ], which makes it invalid JSON.

Ad
source: stackoverflow.com
Ad