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
+10.4k Swift : Convert (cast) Float to String
+7.2k Golang : Check if integer is power of four example
+6.5k Golang : Convert(cast) io.Reader type to string
+11.4k Golang : "https://" not allowed in import path
+5.3k Golang : Extract sub-strings
+20.7k Golang : How to run Golang application such as web server in the background or as daemon?
+4.5k Javascript : Shuffle or randomize array example
+18.2k Golang : Convert seconds to human readable time format example
+6.3k Golang : Rot13 and Rot5 algorithms example
+18.6k Golang : Reset or rewind io.Reader or io.Writer
+20.6k Golang : Setting up/configure AWS credentials with official aws-sdk-go
+7.8k Golang : Heap sort example