I'm used text/template
in golang package to parse text with environment in json string.
Example: https://play.golang.org/p/uARnrOyG4Th
But I have an error: 2009/11/10 23:00:00 Execute: template: Person template:1:19: executing "Person template" at <.id>: can't evaluate field id in type string
Please help me with problem. I couldn't find the error based on the library's documents.
template can't directly apply to string, you should create a struct then unmarshal your JSON string to the struct instance. try the code