Gluing JSON

from blog openmymind.net, | ↗ original
If I asked you to respond to an HTTP request with a JSON serialize list of products, somewhere in your code, you'd probably have (or whatever the equivalent is in your stack): body, err := json.Marshal(products) There's an alternative to this approach that I'm rather fond of: gluing pre-serialized JSON pieces together: if (len(productJSON)) == 0...