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
+16.1k Golang : Loop each day of the current month example
+21k Golang : Get password from console input without echo or masked
+6.3k Golang : Handling image beyond OpenCV video capture boundary
+27k Golang : Find files by name - cross platform example
+46.2k Golang : Encode image to base64 example
+12.8k Python : Convert IPv6 address to decimal and back to IPv6
+28.6k Golang : Detect (OS) Operating System
+16.2k Golang :Trim white spaces from a string
+20.1k Golang : Check if os.Stdin input data is piped or from terminal
+9.1k Golang : does not implement flag.Value (missing Set method)
+15k Golang : How to check if IP address is in range