I am retrieving a set of field values from the Database into an interface type object. One of the field values is a JSON string (say Order detail). I am retrieving it as a string as passing it on to a template and referencing it using {{.orderdetail}} this is the output I get on the client which is a valid json: [{"pid":"d6742e4e-2ad6-43c5-97f4-e8a7b00684e2","image":"1Appleiphone7.jpeg","name":"iphone7","price":70000,"count":1},{"pid":"12d3d8fc-66b6-45f9-a91b-d400b91c32aa","image":"2SamsungGalaxys7.jpeg","name":"SamsungGalaxy7","price":70000,"count":1}]
I am not able to access the values in the json using the keys at client side in the template. {{.orderdetails.pid}} does't yield and value. One way would be to unmarshal the string into a map([string]interface{}) and then pass on the data to the templates. But was curious if there is a way to access the data using the JSON keys. Thanks Rejoy -- 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.