MCPcopy Index your code
hub / github.com/Jeffail/gabs / ParseJSONFile

Function ParseJSONFile

gabs.go:899–914  ·  view source on GitHub ↗

ParseJSONFile reads a file and unmarshals the contents into a *Container.

(path string)

Source from the content-addressed store, hash-verified

897
898// ParseJSONFile reads a file and unmarshals the contents into a *Container.
899func ParseJSONFile(path string) (*Container, error) {
900 if len(path) > 0 {
901 cBytes, err := os.ReadFile(path)
902 if err != nil {
903 return nil, err
904 }
905
906 container, err := ParseJSON(cBytes)
907 if err != nil {
908 return nil, err
909 }
910
911 return container, nil
912 }
913 return nil, ErrInvalidPath
914}
915
916// ParseJSONBuffer reads a buffer and unmarshals the contents into a *Container.
917func ParseJSONBuffer(buffer io.Reader) (*Container, error) {

Callers

nothing calls this directly

Calls 1

ParseJSONFunction · 0.85

Tested by

no test coverage detected