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
+26.5k Golang : How to convert(cast) string to IP address?
+4.5k Golang : Missing Subversion command
+4.3k Golang : Error handling methods
+6.6k Golang : Gonum standard normal random numbers example
+16.9k Golang : Check if directory exist and create if does not exist
+9.1k Golang : Sort and reverse sort a slice of runes
+12.6k Golang : Adding XML attributes to xml data or use attribute to differentiate a common tag name
+7k Golang : Get curl -I or head data from URL example
+8.4k Golang : Fix - does not implement sort.Interface (missing Len method)
+4.4k Golang : How to verify input is rune?
+4.8k Golang : How to fix html/template : "somefile" is undefined error?
+12.9k Golang : Missing Bazaar command