MCPcopy Create free account
hub / github.com/PaesslerAG/jsonpath / parseJSONObjectElement

Function parseJSONObjectElement

placeholder.go:60–81  ·  view source on GitHub ↗
(ctx context.Context, gParser *gval.Parser, hasWildcard bool, key gval.Evaluable)

Source from the content-addressed store, hash-verified

58}
59
60func parseJSONObjectElement(ctx context.Context, gParser *gval.Parser, hasWildcard bool, key gval.Evaluable) (jsonObject, error) {
61 if hasWildcard {
62 p := newParser(gParser)
63 switch gParser.Scan() {
64 case '$':
65 case '@':
66 p.appendPlainSelector(currentElementSelector())
67 default:
68 return nil, p.Expected("JSONPath key and value")
69 }
70
71 if err := p.parsePath(ctx); err != nil {
72 return nil, err
73 }
74 return keyValueMatcher{key, p.path.visitMatchs}, nil
75 }
76 value, err := gParser.ParseExpression(ctx)
77 if err != nil {
78 return nil, err
79 }
80 return keyValuePair{key, value}, nil
81}
82
83func (kv keyValuePair) visitElements(c context.Context, v interface{}, visit keyValueVisitor) error {
84 value, err := kv.value(c, v)

Callers 1

parseJSONObjectFunction · 0.85

Calls 4

newParserFunction · 0.85
currentElementSelectorFunction · 0.85
appendPlainSelectorMethod · 0.80
parsePathMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…