Add JSON utilities back
This commit is contained in:
		| @@ -2,6 +2,7 @@ package main | |||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"bytes" | 	"bytes" | ||||||
|  | 	"encoding/json" | ||||||
| 	"log" | 	"log" | ||||||
| 	"os" | 	"os" | ||||||
| 	"path/filepath" | 	"path/filepath" | ||||||
| @@ -20,6 +21,14 @@ var ProtoHelpersFuncMap = template.FuncMap{ | |||||||
| 	}) string { | 	}) string { | ||||||
| 		return i.String() | 		return i.String() | ||||||
| 	}, | 	}, | ||||||
|  | 	"json": func(v interface{}) string { | ||||||
|  | 		a, _ := json.Marshal(v) | ||||||
|  | 		return string(a) | ||||||
|  | 	}, | ||||||
|  | 	"prettyjson": func(v interface{}) string { | ||||||
|  | 		a, _ := json.MarshalIndent(v, "", "  ") | ||||||
|  | 		return string(a) | ||||||
|  | 	}, | ||||||
| } | } | ||||||
|  |  | ||||||
| type GenericTemplateBasedEncoder struct { | type GenericTemplateBasedEncoder struct { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user