Podger2016 / jsonpath

Automatically exported from code.google.com/p/jsonpath
0 stars 0 forks source link

Suggestion: another types of result #13

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
In larger JSON framework, for jsonpath analysis
it might be usefull to have more resultTypes:

* normalized path - just steps of path as an array 
(w/out tracing target object)

if( P.resultType == "WAY" ) return P.normalize(expr).split(';');
P.trace(P.normalize(expr).replace(/^\$;/,""), obj, "$");
return P.result.length ? P.result : false;

* normalized traced path - with expanded expressions/filters/slices
asTrace: function(path) { return path.split(";"); }
store: function(p, v) { 
  if (p) P.result[P.result.length] = 
    ( P.resultType == "PATH" ? P.asPath(p) : 
    ( P.resultType == "TRACE" ? P.asTrace(p) : v));
  return !!p;
},

Original issue reported on code.google.com by qwigly...@gmail.com on 4 Nov 2009 at 12:19