#community-help

Problem with Uploading JSON Data

TLDR Nikunj has a problem uploading data with JSON file that throws an error. James suggests the issue might lie in the nested object "_highlightResult". Kishore Nallan asks if import end-point is used and points out that each line should contain a JSON object.

Powered by Struct AI
Jan 31, 2023 (8 months ago)
Nikunj
Photo of md5-e86f551204439999ca28639ea0e038b0
Nikunj
06:19 AM
I am trying to upload data through json file
[
  {
  "id": 1,
  "companyId": "62a1ce490f8710001297efcd",
  "jobApplicationId": "63be4edd95e5ed00158a4c25",
  "unassigned": false,
  "jobId": "62a1ce6d0f8710001297efd3",
  "stageId": "62a1ce6d0f8710001297efd6",
  "status": 1,
  "name": "Urvish",
  "email": "",
  "isRejected": false,
  "tags": [],
  "sourceVia": "SpringRecruit Interface",
  "sourceBy": "62a1ce490f8710001297efce",
  "isFavourite": false,
  "userId": "62a1ce490f8710001297efce",
  "createdAt": "2023-01-11T05:53:33.761Z",
  "isProfileCompleted": false,
  "objectID": "63be4edd95e5ed00158a4c24",
  "_highlightResult": {
    "companyId": {
      "value": "62a1ce490f8710001297efcd",
      "matchLevel": "none",
      "matchedWords": []
    },
    "name": {
      "value": "Urvish",
      "matchLevel": "none",
      "matchedWords": []
    }
  }
},
{
  "id": 2,
  "companyId": "5d79f61d0965ef001f9209f9",
  "jobApplicationId": "63bd596e0d55940019475f20",
  "unassigned": false,
  "jobId": "5d7a2fbab4b75f00207b509b",
  "stageId": "5d7a2fbab4b75f00207b509e",
  "status": 1,
  "name": "awzsexdcfvgbhjn",
  "email": "",
  "isRejected": false,
  "resumeLink": "",
  "phone": "+917037222550",
  "tags": [],
  "sourceVia": "SpringRecruit Interface",
  "sourceBy": "62b586daa1d066001a5b8dde",
  "isFavourite": false,
  "userId": "62b586daa1d066001a5b8dde",
  "createdAt": "2023-01-10T12:26:21.954Z",
  "isProfileCompleted": true,
  "objectID": "63bd596d0d55940019475f1f",
  "_highlightResult": {
    "companyId": {
      "value": "5d79f61d0965ef001f9209f9",
      "matchLevel": "none",
      "matchedWords": []
    },
    "name": {
      "value": "awzsexdcfvgbhjn",
      "matchLevel": "none",
      "matchedWords": []
    }
  }
},
{
  "id": 3,
  "companyId": "62e7683cf3fd1c2c34ab70c1",
  "jobApplicationId": "63b27fd943e5956f701be6cc",
  "unassigned": false,
  "jobId": "63638bc81aad0810e0763ebc",
  "stageId": "63638bc81aad0810e0763ebf",
  "status": 1,
  "name": "rdtfghbjnm,",
  "email": "",
  "isRejected": false,
  "resumeLink": "",
  "phone": "+917037000550",
  "tags": [],
  "sourceVia": "Career Page",
  "sourceBy": "Candidate",
  "isFavourite": false,
  "userId": null,
  "createdAt": "2023-01-02T06:55:19.363Z",
  "isProfileCompleted": true,
  "objectID": "63b27fd743e5956f701be6cb",
  "_highlightResult": {
    "companyId": {
      "value": "62e7683cf3fd1c2c34ab70c1",
      "matchLevel": "none",
      "matchedWords": []
    },
    "name": {
      "value": "rdtfghbjnm,",
      "matchLevel": "none",
      "matchedWords": []
    }
  }
},
{
  "id": 4,
  "companyId": "62e7683cf3fd1c2c34ab70c1",
  "jobApplicationId": "63aabc2800f6d16e14115477",
  "unassigned": false,
  "jobId": "63638bc81aad0810e0763ebc",
  "stageId": "63638bc81aad0810e0763ebf",
  "status": 1,
  "name": "SPRINGROLE INDIA PRIVATE LIMITED",
  "email": "",
  "isRejected": false,
  "resumeLink": "",
  "phone": "+911915005075",
  "tags": [],
  "sourceVia": "SpringRecruit Interface",
  "sourceBy": "62e7683cf3fd1c2c34ab70c2",
  "isFavourite": false,
  "userId": "62e7683cf3fd1c2c34ab70c2",
  "createdAt": "2022-12-27T09:34:29.745Z",
  "isProfileCompleted": true,
  "objectID": "63aabc2500f6d16e14115475",
  "_highlightResult": {
    "companyId": {
      "value": "62e7683cf3fd1c2c34ab70c1",
      "matchLevel": "none",
      "matchedWords": []
    },
    "name": {
      "value": "SPRINGROLE INDIA PRIVATE LIMITED",
      "matchLevel": "none",
      "matchedWords": []
    }
  }
},
{
  "id": 5,
  "companyId": "62e7683cf3fd1c2c34ab70c1",
  "jobApplicationId": "63aabc2800f6d16e14115476",
  "unassigned": false,
  "jobId": "6363763d1aad0810e0763e60",
  "stageId": "6363763d1aad0810e0763e63",
  "status": 1,
  "name": "rewqasdfgtyui",
  "email": "",
  "isRejected": false,
  "resumeLink": "",
  "phone": "+918279965511",
  "tags": [],
  "sourceVia": "SpringRecruit Interface",
  "sourceBy": "62e7683cf3fd1c2c34ab70c2",
  "isFavourite": false,
  "userId": "62e7683cf3fd1c2c34ab70c2",
  "createdAt": "2022-12-27T09:34:29.744Z",
  "isProfileCompleted": true,
  "objectID": "63aabc2500f6d16e14115474",
  "_highlightResult": {
    "companyId": {
      "value": "62e7683cf3fd1c2c34ab70c1",
      "matchLevel": "none",
      "matchedWords": []
    },
    "name": {
      "value": "rewqasdfgtyui",
      "matchLevel": "none",
      "matchedWords": []
    }
  }
}
]

it is throwing error, can you please tell where i am wrong
i am used collection with auto detection schema
James
Photo of md5-30d4fe895016bc91ebf1879acf690bab
James
06:30 AM
what is the error you get?
06:34
James
06:34 AM
it might be because you have a nested object... "_highlightResult"
06:34
James
06:34 AM
im not sure though im pretty new to typesnese. try indexing a couple documents without the nested data
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
07:00 AM
Nikunj Are you using the import end-point? If so, the file should be JSON lines, i.e. each line should contain a JSON object. The example above is a proper JSON array. See here for example: https://typesense.org/docs/0.23.1/api/documents.html#import-a-jsonl-file