```go
map[
hits:[
map[
_id:OQpf7HYBhW0_ej1URQbB
_index:student
_score:0.5753642
_source:map[name:New York]
_type:_doc
highlight:map[name:[<font color ='red'>New</font> <font color ='red'>York</font>]]
]
]
max_score:0.5753642
total:map[relation:eq value:1]
]
```
新人请教问题:
**1、怎么遍历取出highlight中的值?**
**2、数据怎么转成json格式?**
更多评论
1
for k, v := range hits["highlight"].(map[string]interface{}) {}
2
j, _ :=json.Marshal(hits["highlight"].(map[string]interface{}))
json :=string(j)
#1
```go
{"name":["\u003cfont color ='red'\u003eNew\u003c/font\u003e \u003cfont color 'red'\u003eYork\u003c/font\u003e "]}
```
谢谢,HTML被转义了
#2