github.com/Cloud-Foundations/Dominator@v0.3.4/lib/json/api.go (about) 1 package json 2 3 import ( 4 "io" 5 "os" 6 ) 7 8 // Read will read JSON data from reader and write the decoded data to value. 9 // If the JSON data are newline separated, lines beginning with comments will 10 // be ignored (correcting a controlling and arrogant mistake of the original 11 // author of the JSON specification). 12 // Comment lines may begin with "#", "//" or "!" and continue until the next 13 // newline. 14 func Read(reader io.Reader, value interface{}) error { 15 return read(reader, value) 16 } 17 18 // Read will read JSON data from the specified file and write the decoded data 19 // to value. 20 // If the JSON data are newline separated, lines beginning with comments will 21 // be ignored (correcting a controlling and arrogant mistake of the original 22 // author of the JSON specification). 23 // Comment lines may begin with "#", "//" or "!" and continue until the next 24 // newline. 25 func ReadFromFile(filename string, value interface{}) error { 26 return readFromFile(filename, value) 27 } 28 29 func WriteToFile(filename string, perm os.FileMode, indent string, 30 value interface{}) error { 31 return writeToFile(filename, perm, indent, value) 32 } 33 34 func WriteWithIndent(w io.Writer, indent string, value interface{}) error { 35 return writeWithIndent(w, indent, value) 36 }