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
+20.9k Android Studio : AlertDialog and EditText to get user string input example
+15k Golang : Submit web forms without browser by http.PostForm example
+10.1k Golang : Get escape characters \u form from unicode characters
+37.8k Golang : Comparing date or timestamp
+11k Golang : Sieve of Eratosthenes algorithm
+8.3k Golang : How To Use Panic and Recover
+21.2k Golang : For loop continue,break and range
+7.8k Golang : How to execute code at certain day, hour and minute?
+7.4k Golang : How to fix html/template : "somefile" is undefined error?
+21k Golang : Underscore or snake_case to camel case example
+12.2k Golang : Find and draw contours with OpenCV example
+13.5k Golang : Increment string example