Golang : invalid character ',' looking for beginning of value
In has been a while since I've encounter a strange error message that I couldn't comprehend. However, today is special since I've encountered this weird error message today while writing examples for Golang.
invalid character ',' looking for beginning of value
and the error was caused by a comma ,
at the end of each JSON data line
var jsonDataStream =
{"Name":"Adam","Age":36,"Job":"CEO"},
{"Name":"Eve","Age":34,"Job":"CFO"},
{"Name":"Mike","Age":38,"Job":"COO"}
to get rid of this error, simply remove the ,
will do
var jsonDataStream =
{"Name":"Adam","Age":36,"Job":"CEO"}
{"Name":"Eve","Age":34,"Job":"CFO"}
{"Name":"Mike","Age":38,"Job":"COO"}
See https://www.socketloop.com/references/golang-encoding-json-newdecoder-function-example
By Adam Ng
IF you gain some knowledge or the information here solved your programming problem. Please consider donating to the less fortunate or some charities that you like. Apart from donation, planting trees, volunteering or reducing your carbon footprint will be great too.
Advertisement
Tutorials
+22.6k Golang : Round float to precision example
+14.1k Elastic Search : Mapping date format and sort by date
+16.2k Golang : Loop each day of the current month example
+22.4k Golang : Convert Unix timestamp to UTC timestamp
+7.2k Ubuntu : connect() to unix:/var/run/php5-fpm.sock failed (13: Permission denied) while connecting to upstream
+35k Golang : Upload and download file to/from AWS S3
+12.6k Golang : Drop cookie to visitor's browser and http.SetCookie() example
+8.5k Golang : Add text to image and get OpenCV's X, Y co-ordinates example
+51.8k Golang : How to get time in milliseconds?
+9.7k Golang : Resumable upload to Google Drive(RESTful) example
+7.6k Golang : Command line ticker to show work in progress