debug.Dump
Syntax
debug.Dump VALUE
Returns
string
{{ $data := "" }}
{{ $p := "data/books.json" }}
{{ with resources.Get $p }}
{{ $opts := dict "delimiter" "," }}
{{ $data = . | transform.Unmarshal $opts }}
{{ else }}
{{ errorf "无法获取资源 %q" $p }}
{{ end }}
<pre>{{ debug.Dump $data }}</pre>
[]interface {}{
map[string]interface {}{
"author": "维克多·雨果",
"rating": 5.0,
"title": "悲惨世界",
},
map[string]interface {}{
"author": "维克多·雨果",
"rating": 4.0,
"title": "巴黎圣母院",
},
}