hello i am working with Elastic Search and Golang and after fetching data from elastic search index in Golang when i send the data to jquery using Json Encoder function of Golang i get "Unexpected token { in JSON "
error while parsing the data in jquery
this is what Goland Json Encoder sends to Jquery:
{"id":212,"user_id":10,"meta_description":"Plot,G-16, Islamabad,In G-16, Islamabad, Islamabad","property_type":"16","Location1":"Pakistan","Location2":"Islamabad","Location3":null,"Location4":"Islamabad","price":1850000,"bedrooms":0,"bathrooms":0,"add_date":{"Time":"0001-01-01T00:00:00Z","Valid":false}}
{"id":213,"user_id":10,"meta_description":"Plot,G-16, Islamabad,In G-16, Islamabad, Islamabad","property_type":"16","Location1":"Pakistan","Location2":"Islamabad","Location3":null,"Location4":"Islamabad","price":1800000,"bedrooms":0,"bathrooms":0,"add_date":{"Time":"0001-01-01T00:00:00Z","Valid":false}}
Your JSON data is missing two Important things, One is, encapsulate it in square brackets and a
','
for each data as separator. More or less it should look like this:I have made very small change, If you are not sure about the data the best option would be to try to validate it here : https://jsonlint.com/