Пожарная база: JSON полезная нагрузка не принимается - PullRequest
0 голосов
/ 18 марта 2020

Я пытаюсь отправить sh JSON из службы в Firebase, и она не принимает ее.

Я не могу понять, почему. JSONLint подтверждает его как действительный.

Я получаю ошибку:

  error: "Invalid data; couldn't parse JSON object, array, or value."

Вот полезная нагрузка JSON:

{
  "app_id": "e4805b8d5a9f4032b0bb8b6d9c6726b8",
  "archived": false,
  "attachments": {
    "form.xml": {
      "content_type": "text/xml",
      "length": 4500,
      "url": "https://someurl.com/form.xml"
    }
  },
  "build_id": "3c5703e20346462ebcb07a3f36d5fe9b",
  "domain": "my-test",
  "edited_by_user_id": null,
  "edited_on": null,
  "form": {
    "#type": "data",
    "@name": "Beneficiary Registration",
    "@uiVersion": "1",
    "@version": "1",
    "@xmlns": "http://openrosa.org/formdesigner/123456",
    "beneficiary_age": {
      "beneficiary_age_num": "8",
      "beneficiary_exact_age_ind": "N"
    },
    "beneficiary_gender_cd": "M",
    "beneficiary_id": "Hhr-O6I3C5L-J3G1L",
    "case": {
      "@case_id": "a07972bc-1a34-4c84-90ea-91250639f2a4",
      "@date_modified": "2020-03-17T20:57:26.986000Z",
      "@user_id": "2275c340c48ac83b6852035b0a15b5d3",
      "@xmlns": "http://someurl.org/case/transaction/v2"
    },
    "case_name": "Hhr-O6I3C5L-J3G1L|joel galager|Katsekera|Katsekera|Mpando|Katsekera|KE",
    "existing_beneficiaries": "Jane Doe\n\nJoan Doe",
    "existing_beneficiaries_label": "",
    "household_information": {
      "beneficiary_household_information_display": "",
      "beneficiary_location_hierarchy_1": "KE",
      "beneficiary_location_hierarchy_1_text": "Kenya",
      "beneficiary_location_hierarchy_2": "HF0001",
      "beneficiary_location_hierarchy_2_text": "Katsekera",
      "beneficiary_location_hierarchy_3": "TA0001",
      "beneficiary_location_hierarchy_3_text": "Mpando",
      "beneficiary_location_hierarchy_4": "GHV0001",
      "beneficiary_location_hierarchy_4_text": "Katsekera",
      "beneficiary_location_hierarchy_5": "V0001",
      "beneficiary_location_hierarchy_5_text": "Katsekera",
      "correct_information": "",
      "hh_first_name": "John",
      "hh_full_name": "John Doe",
      "hh_id_fk": "Hhr-O6I3C5L",
      "hh_last_name": "Doe",
      "household_information": ""
    },
    "meta": {
      "@xmlns": "http://openrosa.org/jr/xforms",
      "appVersion": "Formplayer Version: 2.47",
      "app_build_version": 1,
      "commcare_version": null,
      "deviceID": "Formplayer",
      "drift": "0",
      "geo_point": null,
      "instanceID": "123-321-232",
      "timeEnd": "2020-03-17T20:57:26.986000Z",
      "timeStart": "2020-03-17T20:57:13.958000Z",
      "userID": "2275c340c48ac83b6852035b0a15b5d3",
      "username": "some_username"
    },
    "name_group": {
      "beneficiary_first_name": "joel",
      "beneficiary_full_name": "joel galager",
      "beneficiary_last_name": "galager"
    },
    "subcase_0": {
      "case": {
        "@case_id": "2a4bfe27-a5c3-4f3a-8540-5f8ded86db85",
        "@date_modified": "2020-03-17T20:57:26.986000Z",
        "@user_id": "abc123",
        "@xmlns": "http://commcarehq.org/case/transaction/v2",
        "create": {
          "case_name": "Hhr-O6I3C5L-J3G1L|joel galager|Katsekera|Katsekera|Mpando|Katsekera|KE",
          "case_type": "beneficiary_case",
          "owner_id": "abc123"
        },
        "index": {
          "parent": {
            "#text": "a07972bc-1a34-4c84-90ea-91250639f2a4",
            "@case_type": "household_case"
          }
        },
        "update": {
          "beneficiary_age_num": "8",
          "beneficiary_exact_age_ind": "N",
          "beneficiary_first_name": "joel",
          "beneficiary_full_name": "joel galager",
          "beneficiary_gender_cd": "M",
          "beneficiary_id": "Hhr-O6I3C5L-J3G1L",
          "beneficiary_last_name": "galager",
          "beneficiary_location_hierarchy_1": "KE",
          "beneficiary_location_hierarchy_1_text": "Kenya",
          "beneficiary_location_hierarchy_2": "HF0001",
          "beneficiary_location_hierarchy_2_text": "Katsekera",
          "beneficiary_location_hierarchy_3": "TA0001",
          "beneficiary_location_hierarchy_3_text": "Mpando",
          "beneficiary_location_hierarchy_4": "GHV0001",
          "beneficiary_location_hierarchy_4_text": "Katsekera",
          "beneficiary_location_hierarchy_5": "V0001",
          "beneficiary_location_hierarchy_5_text": "Katsekera",
          "hh_id_fk": "Hhr-O6I3C5L"
        }
      }
    }
  },
  "id": "d547ccea-503c-4c50-b974-38ed564ae78a",
  "indexed_on": "2020-03-17T21:01:04.695654",
  "initial_processing_complete": true,
  "is_phone_submission": true,
  "metadata": {
    "appVersion": "Formplayer Version: 2.47",
    "app_build_version": 1,
    "commcare_version": null,
    "deviceID": "Formplayer",
    "drift": "0",
    "geo_point": null,
    "instanceID": "01010101",
    "location": null,
    "timeEnd": "2020-03-17T20:57:26.986000Z",
    "timeStart": "2020-03-17T20:57:13.958000Z",
    "userID": "2275c340c48ac83b6852035b0a15b5d3",
    "username": "myusername"
  },
  "problem": null,
  "received_on": "2020-03-17T20:57:27.179986Z",
  "resource_uri": "",
  "server_modified_on": "2020-03-17T20:57:27.382548Z",
  "type": "data",
  "uiversion": "1",
  "version": "1"
}

1 Ответ

2 голосов
/ 18 марта 2020

Это, вероятно, из-за #type внутри form.

Символ # нельзя использовать в путях RTDB.

См. Как структурированы данные из документов.

Ключи не могут содержать

  • .
  • $
  • #
  • [
  • ]
  • /
  • Контрольные символы ASCII 0-31 или 127
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...