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
+5.8k Golang : Extract unicode string from another unicode string example
+15.8k Golang : Get sub string example
+18.3k Golang : Iterating Elements Over A List
+8.8k Golang : Get curl -I or head data from URL example
+18.6k Golang : How to make function callback or pass value from function as parameter?
+9.9k Golang : Get login name from environment and prompt for password
+11.1k Golang : Delay or limit HTTP requests example
+17.2k Golang : Check if IP address is version 4 or 6
+7.6k Golang : Ways to recover memory during run time.
+11.3k Golang : Change date format to yyyy-mm-dd
+8.5k Golang : How to join strings?
+17.8k Golang : Check if a directory exist or not