Open cthorner opened 5 years ago
@cthorner stringify takes an input representative of JSONPath components, either as an array of strings or an array of parsed path expressions, and converts them into a string path:
jp.stringify(path)
Returns a path expression in string form, given a path. The supplied path may either be a flat array of keys, as returned by jp.nodes for example, or may alternatively be a fully parsed path expression in the form of an array of path components as returned by jp.parse.
var pathExpression = jp.stringify(['$', 'store', 'book', 0, 'author']);
// "$.store.book[0].author
Parsed path expressions must consist of an array of objects each containing 'operation', 'scope', and 'expression' members. The internal parser is responsible for converting a given string into an array in this format. See JSONPath#_normalize (private) method for how arrays of individual path component strings are converted into arrays of these objects.
Your input to stringify isn't compliant with any of these valid input types, hence you are getting an error
For array data
I am not able to get stringify to work for a give path
to reproduce:
throws: Uncaught Error: couldn't understand path 1,name at JSONPath._normalize (jsonpath.js:5100)