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
+7.3k Golang : Rename part of filename
+6.3k Golang : Convert an executable file into []byte example
+12.8k Swift : Convert (cast) Int to String ?
+7.9k Golang : Multiplexer with net/http and map
+7.8k Golang : Sort words with first uppercase letter
+7.1k Golang : Calculate how many weeks left to go in a given year
+6.7k Golang : How to setup a disk space used monitoring service with Telegram bot
+25k Golang : convert rune to integer value
+7.2k Golang : Hue, Saturation and Value(HSV) with OpenCV example
+21.8k Golang : Convert seconds to minutes and remainder seconds
+9.8k CodeIgniter : Load different view for mobile devices
+13.2k Golang : Read XML elements data with xml.CharData example