MCPcopy Index your code
hub / github.com/cloudfoundry/cli / ParseJSONArray

Function ParseJSONArray

cf/util/json/json_parser.go:10–27  ·  view source on GitHub ↗
(path string)

Source from the content-addressed store, hash-verified

8)
9
10func ParseJSONArray(path string) ([]map[string]interface{}, error) {
11 if path == "" {
12 return nil, nil
13 }
14
15 bytes, err := readJSONFile(path)
16 if err != nil {
17 return nil, err
18 }
19
20 stringMaps := []map[string]interface{}{}
21 err = json.Unmarshal(bytes, &stringMaps)
22 if err != nil {
23 return nil, fmt.Errorf("Incorrect json format: %s", err.Error())
24 }
25
26 return stringMaps, nil
27}
28
29func ParseJSONFromFileOrString(fileOrJSON string) (map[string]interface{}, error) {
30 var jsonMap map[string]interface{}

Callers 3

ExecuteMethod · 0.92
ExecuteMethod · 0.92

Calls 2

readJSONFileFunction · 0.85
ErrorMethod · 0.65

Tested by

no test coverage detected