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
+8.1k Golang : HTTP Server Example
+14.9k Golang : Basic authentication with .htpasswd file
+5.8k Javascript : How to replace HTML inside <div>?
+8.7k Golang : Progress bar with ∎ character
+6.9k Fix sudo yum hang problem with no output or error messages
+12.2k Golang : convert(cast) string to integer value
+25.4k Golang : Convert long hexadecimal with strconv.ParseUint example
+19.9k Golang : Accept input from user with fmt.Scanf skipped white spaces and how to fix it
+14k Golang : concatenate(combine) strings
+4.8k PHP : Extract part of a string starting from the middle
+19.3k Golang : Calculate entire request body length during run time
+38.1k Golang : Read a text file and replace certain words