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

Function parseJSONObject

placeholder.go:31–58  ·  view source on GitHub ↗
(ctx context.Context, p *gval.Parser)

Source from the content-addressed store, hash-verified

29}
30
31func parseJSONObject(ctx context.Context, p *gval.Parser) (gval.Evaluable, error) {
32 evals := jsonObjectSlice{}
33 for {
34 switch p.Scan() {
35 default:
36 hasWildcard := false
37
38 p.Camouflage("object", ',', '}')
39 key, err := p.ParseExpression(context.WithValue(ctx, hasPlaceholdersContextKey{}, &hasWildcard))
40 if err != nil {
41 return nil, err
42 }
43 if p.Scan() != ':' {
44 if err != nil {
45 return nil, p.Expected("object", ':')
46 }
47 }
48 e, err := parseJSONObjectElement(ctx, p, hasWildcard, key)
49 if err != nil {
50 return nil, err
51 }
52 evals.addElements(e)
53 case ',':
54 case '}':
55 return evals.evaluable, nil
56 }
57 }
58}
59
60func parseJSONObjectElement(ctx context.Context, gParser *gval.Parser, hasWildcard bool, key gval.Evaluable) (jsonObject, error) {
61 if hasWildcard {

Callers

nothing calls this directly

Calls 2

addElementsMethod · 0.95
parseJSONObjectElementFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…