jsonfirebaseparsinggoogle-cloud-firestoreautohotkey

Firestore JSON parsing terminated


I tried many ways to fix it , but i couldn't .

JSON :

jsonData := '{"select": {"fields": [{"fieldPath": "name1"}]}, "from": [{"collectionId": "collec"}], "where": {"fieldFilter": {"field": {"fieldPath": "name2"}, "op": "EQUAL", "value": {"stringValue": "mac"}}}}}'

error :

invalid JSON payload received , parsing terminated before end of input.

It refers to:

{"stringValue": "mac"}
                 ^

even a JSON formatter tells its correct

I saw firebase doc and i didn't find any solution


Solution

  • There's an extra trailing } at the end. Remove that and the JSON will then resolve to:

    {
      "select": {
        "fields": [
          {
            "fieldPath": "name1"
          }
        ]
      },
      "from": [
        {
          "collectionId": "collec"
        }
      ],
      "where": {
        "fieldFilter": {
          "field": {
            "fieldPath": "name2"
          },
          "op": "EQUAL",
          "value": {
            "stringValue": "mac"
          }
        }
      }
    }