在JSON解码器中将指针转换为其主要值

How can I convert *string to string?

Heres my error code:

cannot use m.Body (type *string) as type string in argument to strings.NewReader

Here is my code:

dec := json.NewDecoder(strings.NewReader(m.Body))

Dereference the pointer to get the value of string from *string and then use it in strings.NewReader function. For eg:-

strValue := *m.Body
dec := json.NewDecoder(strings.NewReader(strValue))

For working example check Go playground