JSONPath or other XPath like utility for JSON/Javascript; or Jquery JSON

前端 未结 8 1971
误落风尘
误落风尘 2020-12-28 08:39

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?

8条回答
  •  甜味超标
    2020-12-28 08:56

    Dojo's dojo.getObject has a facility that works loosely like this, where you can provide a path like "a.b.c" to the property you want to fetch.

    Check it out:

    http://api.dojotoolkit.org/jsdoc/1.3/dojo.getObject

    I don't think it understands arrays quite that well and I think it is missing a full-featured selector language like the one you are suggesting.

    As for usage, I've coded a selector language like the one you are suggesting, but for a client, and array addressing is very proprietary to their particular object structure.

    I would definitely use a system like this if you were to make it, and perhaps even contribute if I saw an area I could help with.

提交回复
热议问题