MarshalJSONFile writes the JSON encoding of v to a file named by filename. The file is created atomically. If the file does not exist, Marshal creates it with permissions perm.
(v any, filename string, perm os.FileMode)
| 11 | // The file is created atomically. If the file does not exist, Marshal creates |
| 12 | // it with permissions perm. |
| 13 | func MarshalJSONFile(v any, filename string, perm os.FileMode) (err error) { |
| 14 | return ReplaceFile(filename, perm, func(w io.Writer) error { |
| 15 | e := json.NewEncoder(w) |
| 16 | e.SetIndent("", " ") |
| 17 | return e.Encode(v) |
| 18 | }) |
| 19 | } |
| 20 | |
| 21 | // UnmarshalJSONFile parses JSON-encoded data from the file named by filename |
| 22 | // and stores the result in the value pointed to by v. Internally, Unmarshal |
nothing calls this directly
no test coverage detected