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
+6.8k Golang : Squaring elements in array
+41.1k Golang : Convert string to array/slice
+20.9k Golang : How to get time zone and load different time zone?
+18.2k Golang : Iterating Elements Over A List
+10.9k CodeIgniter : How to check if a session exist in PHP?
+10.7k Golang : Simple image viewer with Go-GTK
+8.3k Golang : Another camera capture GUI application with GTK and OpenCV
+8.5k Golang : Random integer with rand.Seed() within a given range
+12.6k Python : Convert IPv6 address to decimal and back to IPv6
+13.1k Facebook PHP getUser() returns 0
+16.7k Golang : XML to JSON example
+17.9k Golang : How to remove certain lines from a file