Giter Site home page Giter Site logo

Dot key + filter about jsonpath HOT 1 OPEN

Etwenn avatar Etwenn commented on May 25, 2024
Dot key + filter

from jsonpath.

Comments (1)

Rudraksh2003 avatar Rudraksh2003 commented on May 25, 2024

The problem arises because dots are typically used as delimiters in JSONPath expressions, so having a key with a dot in it can lead to unexpected behavior.

In this case, since your key is "item.thing," it is being interpreted as a nested structure. You've tried escaping the dot with quotes, but it seems that the filter function is causing complications.

One way to approach this is to use the bracket notation to access the property. Here's an example that might work for your case:

json

['item.thing'][?(@.key=="match")].value
This way, you are treating "item.thing" as a single key rather than a nested structure. The bracket notation can help in cases where the key contains special characters like dots.

Your expression might look like this:

json

['item.thing'][?(@.key=="match")].value.get(0)=='b'

This assumes that the JSONPath library you are using supports the bracket notation for keys.

If this doesn't work, you might need to refer to the documentation or specific implementation details of the JSONPath library you are using to see if there are any special considerations or syntax for handling keys with dots. If the library supports escaping characters in keys, check for the correct syntax according to its documentation.

from jsonpath.

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.