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
+8.1k Golang : How to check if a string with spaces in between is numeric?
+9.6k Golang : Roll the dice example
+4.3k JavaScript/JQuery : Redirect page examples
+8.5k Golang : How to protect your source code from client, hosting company or hacker?
+21.2k Golang : How to read JPG(JPEG), GIF and PNG files ?
+18.7k Golang : Accept input from user with fmt.Scanf skipped white spaces and how to fix it
+6.3k Golang : Process json data with Jason package
+9.6k Golang : Bubble sort example
+8.9k Golang : Check a web page existence with HEAD request example
+8.3k Golang : Scramble and unscramble text message by randomly replacing words
+12.5k Golang : Check if an integer is negative or positive
+16.7k Golang : Get all upper case or lower case characters from string example