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.5k Golang : How to detect if a sentence ends with a punctuation?
+17.1k Golang : Covert map/slice/array to JSON or XML format
+6.1k PageSpeed : Clear or flush cache on web server
+6.2k Golang : Get missing location after unmarshal binary and gob decode time.
+14.2k Golang : syscall.Socket example
+16k Golang : Read a file line by line
+8.2k Golang : Multiplexer with net/http and map
+9.7k Golang : Copy map(hash table) example
+32.1k Golang : Convert an image file to []byte
+20.3k Golang : Reset or rewind io.Reader or io.Writer
+46.3k Golang : Read tab delimited file with encoding/csv package
+6.4k Golang : How to get capacity of a slice or array?