Note that there are some explanatory texts on larger screens.

plurals
  1. POJSONPath or other XPath like utility for JSON/Javascript; or Jquery JSON
    primarykey
    data
    text
    <p>I have been looking at JSONPath and though it seems pretty well done, I wonder if anyone has worked with it and can comment on its usability, or can recommend alternatives? What would be <em>really</em> slick is if there was a plugin for JQuery that did something like this. I have been searching the plugins and coming up empty handed. Anyway, before I spend time getting to know JSONPath (which has some aspects I am not keen on), or before I reinvent wheels, I thought I'd see if anyone had an angle on this...</p> <p>To give you an idea what I mean, imagine this Javascript object:</p> <pre><code>var Characters=[ { id: "CuriousGeorge", species:"Monkey", mood: "curious", appendage: [ { type: "hand", side: "left", holding: [ { id: "Banana" } ] }, { type: "hand", side: "right", holding: [] }, { type: "foot", side: "left", holding: [] }, { type: "foot", side: "right", holding: [ { id: "YellowHat" }, { id: "Keys" } ] } ] }, { id: "ManInYellowHat", species: "Human", mood: "angry", //...ok, you get it... } ] </code></pre> <p>Wouldn't it be great to get to of some of the deeper objects by something like Jquery selectors?</p> <pre><code>var banana=SomeUtility("Characters holding #Banana").get(0); var leftHands=SomeUtility("Characters appendage[type=hand][side=left]").get(); </code></pre> <p>(This may qualify for worlds corniest code example, but hey, my kids just watched this. And I can't use real example because of NDA...)</p> <p>...And, to make it more interesting, if I were to create such a thing, would anyone use it?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload