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
+11.8k Golang : Convert decimal number(integer) to IPv4 address
+9.3k Mac OSX : Get a process/daemon status information
+4.7k HTTP common errors and their meaning explained
+13.2k Golang : Read from buffered reader until specific number of bytes
+8.1k Golang : Check if integer is power of four example
+26.7k Golang : Force your program to run with root permissions
+8.9k Golang : Capture text return from exec function example
+5.9k Golang : Convert Chinese UTF8 characters to Pin Yin
+12.1k Golang : calculate elapsed run time
+6.3k Golang : Handling image beyond OpenCV video capture boundary
+20.4k Nginx + FastCGI + Go Setup.
+7.4k Golang : Shuffle strings array