Here, I'm not going to talk about what the official website maps to the structure or anything, just a little bit of my own exploration
The HTML page code is as follows, the following example HTML generic
Convert string to JSON
The target string "{' Eooall ', ' Eooall '}", we will first turn the single quotation mark of this string into double quotation marks and then convert to a byte array. Verified by the Ajax of the page, the code is as follows
str:= "{' Eooall ', ' Eooall '}"
Newstr:=strings. Replace (str, "'", "\" ",-1)
Callback Ajax data
W.writer ([]type (b))
The code is as follows
The results are as follows
Map to JSON
The code is as follows
The results are as follows
interface forwarding type, because I am playing the crawler, I use go to request other people's interface, and I do not know the structure of the JSON, so I can not write the corresponding structure, and then this operation, can be forwarded what, the use is still very large
The code is as follows
The results are as follows
From the above can be known that the return JSON can use go to provide good or complete their own assembly, the key is to return the data when W. Wreter () is a []byte type of value, just throw the string in it, if the string can be converted to JSON.
The playful JSON of Go language