Skip to main content
Best answer

Firebase structured query error in json


I have continued without success  to try and test the trigger which connect to my firestore.

I want to trigger when a new document is added to a collection. here is the code:

{
  "select":
      {
  "fields": [
    {
      "measureRef"
    }
  ]
  },
  "from": [
    {
      "CompletedMeasures
    }
  ]
}

I keep getting this error

Failed to fetch a record from Firebase / Firestore
Error while retrieving: The specified query does not contain valid JSON. Unexpected token } in JSON at position 65

I have added/removed the braces but not joy.. Help please what’s wrong??

Best answer by GetUWiredBest answer by GetUWired

Hi @myfitter 
That is not valid JSON. 

Objects (curly brackets) should have valid key & value pairs. i.e {key: value}. Your objects just have values.  Structured query docs are here: https://firebase.google.com/docs/firestore/reference/rest/v1beta1/StructuredQuery

{

"select": {

    "fields": [
      {

       "fieldPath": "measureRef" 
  }  

  ]

},

"from": [

{

"collectionId": string,

"allDescendants": boolean

}

]

}

 

FROM DOCUMENTS: https://firebase.google.com/docs/firestore/reference/rest/v1beta1/StructuredQuery#CollectionSelector

View original
Did this topic help you find an answer to your question?
This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

2 replies

GetUWired
Forum|alt.badge.img+12
  • Zapier Expert
  • 1030 replies
  • Answer
  • May 16, 2022

Hi @myfitter 
That is not valid JSON. 

Objects (curly brackets) should have valid key & value pairs. i.e {key: value}. Your objects just have values.  Structured query docs are here: https://firebase.google.com/docs/firestore/reference/rest/v1beta1/StructuredQuery

{

"select": {

    "fields": [
      {

       "fieldPath": "measureRef" 
  }  

  ]

},

"from": [

{

"collectionId": string,

"allDescendants": boolean

}

]

}

 

FROM DOCUMENTS: https://firebase.google.com/docs/firestore/reference/rest/v1beta1/StructuredQuery#CollectionSelector


  • Author
  • Beginner
  • 1 reply
  • May 16, 2022

Thanks for taking the time to respond.

Still finding my way round JSON - starting to understand it better now - that helps a lot thank you!!