Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Expected: OBJECT_START but got ARRAY_START at [16]

Tags:

json

solr

ubuntu

How to add multiple JSON documents through the Solr Admin Documents page?

I tried with json:

[ 
{ 
   "id" : "001", 
   "name" : "Ram", 
   "age" : 53, 
   "Designation" : "Manager", 
   "Location" : "Hyderabad", 
}, 
{ 
   "id" : "002", 
   "name" : "Robert", 
   "age" : 43, 
   "Designation" : "SR.Programmer", 
   "Location" : "Chennai", 
}, 
{ 
   "id" : "003", 
   "name" : "Rahim", 
   "age" : 25, 
   "Designation" : "JR.Programmer", 
   "Location" : "Delhi", 
} 
]

After click Submit Document, it returns errors:

Status: error Error: Bad Request "msg": "Expected: OBJECT_START but got ARRAY_START at [16]", "code": 400

like image 593
Ken Nguyen Avatar asked Mar 09 '23 10:03

Ken Nguyen


1 Answers

Remove the [ ] bracket, this works for me.

{ 
      "id" : "001", 
      "name" : "Ram", 
      "age" : 53, 
      "Designation" : "Manager", 
      "Location" : "Hyderabad" 
   }, 
   { 
      "id" : "002", 
      "name" : "Robert", 
      "age" : 43, 
      "Designation" : "SR.Programmer", 
      "Location" : "Chennai"
   }, 
   { 
      "id" : "003", 
      "name" : "Rahim", 
      "age" : 25, 
      "Designation" : "JR.Programmer", 
      "Location" : "Delhi" 
   } 
like image 131
Harmohan Sharma Avatar answered Mar 12 '23 01:03

Harmohan Sharma