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
+5k Facebook : How to force facebook to scrape latest URL link data?
+10.2k Golang : Post data with url.Values{}
+12.1k Golang : How to get a user home directory path?
+11.2k Golang : Listen and Serve on sub domain example
+35.6k Upload multiple files with Go
+4.6k PHP : Convert string to timestamp or datestamp before storing to database(MariaDB/MySQL)
+4.2k PHP : See installed compiled-in-modules
+6k Linux : How to fix Brother HL-1110 printing blank page problem
+6.5k Golang : Handling Yes No Quit query input
+4.8k nginx : force all pages to be SSL
+6.5k Golang : Command line ticker to show work in progress
+12.5k Golang : Check if an integer is negative or positive