MCPcopy
hub / github.com/tidwall/gjson / TestDeepModifierWithOptions

Function TestDeepModifierWithOptions

gjson_test.go:2616–2633  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2614}
2615
2616func TestDeepModifierWithOptions(t *testing.T) {
2617 rawJson := `{"x":[{"y":[{"z":{"b":1, "c": 2, "a": 3}}]}]}`
2618 jsonPathExpr := `x.#.y.#.z.@pretty:{"sortKeys":true}`
2619 results := GetManyBytes([]byte(rawJson), jsonPathExpr)
2620 assert(t, len(results) == 1)
2621 actual := results[0].Raw
2622 expected := `[[{
2623 "a": 3,
2624 "b": 1,
2625 "c": 2
2626}
2627]]`
2628 if expected != actual {
2629 t.Fatal(strconv.Quote(rawJson) + "\n\t" +
2630 expected + "\n\t" +
2631 actual + "\n\t<<< MISMATCH >>>")
2632 }
2633}
2634
2635func TestIssue301(t *testing.T) {
2636 json := `{

Callers

nothing calls this directly

Calls 2

GetManyBytesFunction · 0.85
assertFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…