You are declaring your struct as []struct and then using it as ”var collect []Crypto4” effectively doubling the arraynes 😉
See this: https://play.golang.org/p/Q3RzNddeVVT And on a side note: Please check your errors – especially if Things doesn’t work – a few err != nil along with fmt.Println’s will save the day 😊 -- Michael Banzon https://michaelbanzon.com/ Fra: m_@li Sendt: 1. maj 2018 16:05 Til: golang-nuts Emne: [go-nuts] 1: json: cannot unmarshal array into Go value of typemain.Catcher or 2: json: cannot unmarshal object into Go value of typemain.Crypto4 Hi ! I was searching relevant posts regarding error "json: cannot unmarshal array into Go value of type main.Catcher" or "json: cannot unmarshal object into Go value of type main.Crypto4". These two error messages are linked to the same program (depends on when I change structure). Actually I have to write/display data on HTML file which will linked through local host port 8080. I could not understand where is the problem I have shared my code and link is attached here. https://play.golang.org/p/DLOdEGS7hmG (I have quoted main problem with my code instead of write down all the code, means another function where I presented json data through api and it works good, but presentation of data on html file is the problem. I have created slice like var collect []Crypto4 inside the function and unmarshall data through this variable, but still getting error and html file is not displaying data, instead of getting error which I wrote above in title. It would be so nice to guide me and point out the problem with possible solutions, thanks. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.