MCPcopy Index your code
hub / github.com/larksuite/cli / parseJSONObject

Function parseJSONObject

shortcuts/base/helpers.go:34–51  ·  view source on GitHub ↗
(pc *parseCtx, raw string, flagName string)

Source from the content-addressed store, hash-verified

32}
33
34func parseJSONObject(pc *parseCtx, raw string, flagName string) (map[string]interface{}, error) {
35 resolved, err := loadJSONInput(pc, raw, flagName)
36 if err != nil {
37 return nil, err
38 }
39 var result map[string]interface{}
40 if err := common.ParseJSON([]byte(resolved), &result); err != nil {
41 var syntaxErr *json.SyntaxError
42 if errors.As(err, &syntaxErr) {
43 return nil, formatJSONError(flagName, "object", err)
44 }
45 return nil, baseFlagErrorf("--%s must be a JSON object; %s", flagName, jsonInputTip(flagName))
46 }
47 if result == nil {
48 return nil, baseFlagErrorf("--%s must be a JSON object; %s", flagName, jsonInputTip(flagName))
49 }
50 return result, nil
51}
52
53func parseJSONArray(pc *parseCtx, raw string, flagName string) ([]interface{}, error) {
54 resolved, err := loadJSONInput(pc, raw, flagName)

Callers 15

dryRunFieldUpdateFunction · 0.85
validateFieldJSONFunction · 0.85
executeFieldUpdateFunction · 0.85
TestParseHelpersFunction · 0.85
workflow_update.goFile · 0.85
parseRecordFilterFlagFunction · 0.85
recordSearchJSONBodyFunction · 0.85
resolveRecordSelectionFunction · 0.85
dryRunRecordUpsertFunction · 0.85
dryRunRecordBatchCreateFunction · 0.85
dryRunRecordBatchUpdateFunction · 0.85
validateRecordJSONFunction · 0.85

Calls 6

ParseJSONFunction · 0.92
loadJSONInputFunction · 0.85
formatJSONErrorFunction · 0.85
baseFlagErrorfFunction · 0.85
jsonInputTipFunction · 0.85
AsMethod · 0.80

Tested by 1

TestParseHelpersFunction · 0.68