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
+13.6k Golang : Fix cannot use buffer (type bytes.Buffer) as type io.Writer(Write method has pointer receiver) error
+10.6k Nginx : TLS 1.2 support
+6.5k Mac OSX : Find large files by size
+12.9k Android Studio : Password input and reveal password example
+15.8k Golang : convert string or integer to big.Int type
+5.6k Golang : List all packages and search for certain package
+17.5k Golang : How to log each HTTP request to your web server?
+5.9k Golang : How to get capacity of a slice or array?
+33.6k Golang : Smarter Error Handling with strings.Contains()
+29.4k Golang : Get and Set User-Agent examples
+11.6k Linux : How to install driver for 600Mbps Dual Band Wifi USB Adapter