Parse attempts to parse the given buffer as JSON and, if successful, returns a hcl.File for the HCL configuration represented by it. This is not a generic JSON parser. Instead, it deals only with the profile of JSON used to express HCL configuration. The returned file is valid only if the returned
(src []byte, filename string)
| 21 | // from its HasErrors method. If HasErrors returns true, the file represents |
| 22 | // the subset of data that was able to be parsed, which may be none. |
| 23 | func Parse(src []byte, filename string) (*hcl.File, hcl.Diagnostics) { |
| 24 | return ParseWithStartPos(src, filename, hcl.Pos{Byte: 0, Line: 1, Column: 1}) |
| 25 | } |
| 26 | |
| 27 | // ParseWithStartPos attempts to parse like json.Parse, but unlike json.Parse |
| 28 | // you can pass a start position of the given JSON as a hcl.Pos. |