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
+5.4k PHP : Hide PHP version information from curl
+11.5k Golang : Fix fmt.Scanf() on Windows will scan input twice problem
+5.8k Fix yum-complete-transaction error
+29.6k Golang : How to create new XML file ?
+16.6k Golang : Check if a string contains multiple sub-strings in []string?
+48k Golang : Convert int to byte array([]byte)
+7.6k Golang : Hue, Saturation and Value(HSV) with OpenCV example
+4.7k Javascript : Access JSON data example
+5.7k PHP : Convert CSV to JSON with YQL example
+11.8k Golang : Concurrency and goroutine example
+12.2k Golang : Save webcamera frames to video file
+10.5k Swift : Convert (cast) String to Integer