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
551 Golang : Customize scanner.Scanner to treat dash as part of identifier
+10.4k Golang : Example for DSA(Digital Signature Algorithm) package functions
+8.3k Golang : Convert(cast) int to int64
+4.5k Golang : How to feed or take banana with Gorilla Web Toolkit Session package
+7k Golang : Count JSON objects and convert to slice/array
+12.5k Golang : Get executable name behind process ID example
+24.4k Golang : Get hardware information such as disk, memory and CPU usage
+1.1k Java : Human readable password generator
+2.4k Golang : Takes a plural word and makes it singular
+7.9k Golang : Get current URL example
+7.3k Golang : Get the IPv4 and IPv6 addresses for a specific network interface
+10.4k Golang : Create and resolve(read) symbolic links