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
+10.6k Golang : How to detect a server/machine network interface capabilities?
+4.7k PHP : Get client IP address
+44.1k Golang : Marshal and unmarshal json.RawMessage struct example
+6.3k Golang : Not able to grep log.Println() output
+12.3k Golang : Query string with space symbol %20 in between
+8.7k PHP : Get coordinates latitude/longitude from string
+8.9k CodeIgniter : Load different view for mobile devices
+3.2k Javascript : Empty an array example
+3.7k JavaScript: Add marker function on Google Map
+3.8k Golang : Get a list of crosses(instruments) available to trade from Oanda account
+14.2k Golang : How to convert(cast) IP address to string?
+4.3k Unix/Linux/MacOSx : How to remove an environment variable ?