jsonpath icon indicating copy to clipboard operation
jsonpath copied to clipboard

root array with filter expression does not work

Open asaf opened this issue 7 years ago • 0 comments

hey,

seems like root array with filter exp doesn't work

here's an example:

arr := []map[string]interface{}{
		{
			"id": 1,
			"foo": map[string]interface{}{
				"bar": "baz",
			},
		},
	}

obj := map[string][]map[string]interface{}{
	"obj": arr,
}

// yields result
jsonpath.JsonPathLookup(obj, "$.obj[?(@.id == 1)]")

// yields no result
jsonpath.JsonPathLookup(arr, path, "$.[?(@.id == 1)]")

thanks!

asaf avatar Aug 08 '18 08:08 asaf