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.1k Golang : Delay or limit HTTP requests example
+35k Golang : Strip slashes from string example
+34.2k Golang : Smarter Error Handling with strings.Contains()
+4.4k MariaDB/MySQL : How to get version information
+11.1k Golang : How to flush a channel before the end of program?
+6.9k Ubuntu : connect() to unix:/var/run/php5-fpm.sock failed (13: Permission denied) while connecting to upstream
+18.6k Golang : How to make function callback or pass value from function as parameter?
+5.4k Javascript : How to refresh page with JQuery ?
+25.9k Golang : Get executable name behind process ID example
+29k Golang : How to create new XML file ?
+6.3k Golang : Combine slices of complex numbers and operation example