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
+5.8k Golang : Get expvar(export variables) to work with multiplexer
+5.7k Golang : Warp text string by number of characters or runes example
+15k Golang : Execute terminal command to remote machine example
+12.4k Golang : Convert spaces to tabs and back to spaces example
+4.3k Javascript : Change page title to get viewer attention
+12.8k Golang : How to check if your program is running in a terminal
+12.1k Facebook PHP getUser() returns 0
+6.2k Golang : Check if one string(rune) is permutation of another string(rune)
+20.5k Golang : Join arrays or slices example
+12.2k Golang : reCAPTCHA example
+6.6k Golang : Gorrila set route name and get the current route name