Open joelleortiz opened 3 years ago
When using stringify, the path expression output is not directly compatible for use in the query function to get data from objects.
stringify
query
stringify output: $.response.items["*"]["iso-1234"] query input: $.response.items[*]['iso-1234'] stringify output: $.items["*"]["\"te\\st\""] query input: $.items[*]['\"te\\st\"']
i suspect it's because of the JSON.stringify step for string literals:
JSON.stringify
https://github.com/dchester/jsonpath/blob/c1dd8ec74034fb0375233abb5fdbec51ac317b4b/lib/index.js#L179
Are the two functions (stringify and query) meant to be used together in this way? Or is there any other way to generate a path expression from an array of element paths that can be directly used to query data later?
Struggling with the same issue of [*] becoming ["*"].
[*]
["*"]
When using
stringify
, the path expression output is not directly compatible for use in thequery
function to get data from objects.i suspect it's because of the
JSON.stringify
step for string literals:https://github.com/dchester/jsonpath/blob/c1dd8ec74034fb0375233abb5fdbec51ac317b4b/lib/index.js#L179
Are the two functions (
stringify
andquery
) meant to be used together in this way? Or is there any other way to generate a path expression from an array of element paths that can be directly used to query data later?