Code Monkey home page Code Monkey logo

Comments (1)

hbi99 avatar hbi99 commented on June 10, 2024

Hi @Scnck,
There are at least two ways to do this (that I know of). The examples below uses the XPath Evaluator at https://www.defiantjs.com/ The first one is this - enter the following XPath in the input field:

//store[.//isbn]/bicycle

...this "tells" that we are looking for the store node and make a sub-query with "[...]". In this case I added that I want to make further search with store as "base".

The second one is this:

//@price[ancestor::book//category = "fiction"]

...this "tells" that we want @price but only if it's ancestor is "book" and @price are among the one with category of "fiction". With "//", the query is looking for matches that is regardless of "depth" - meaning "category" and "@price" does not need to be on the same level in depth if the data structure.

I hope this helps. I would like to suggest that you cut and paste part of your JSON data in to the Evaluator by clicking the "pen". This way you can experiment your way to the right query you are looking for. I am closing this issue - re-open it, if you need further assistance.

from defiant.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.