Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    James Saryerwinnie
    @jamesls
    @chris-armstrong I'm thinking it might be helpful to create a new repo that's just for proposing new functionality. Right now there's not really a good way to do that.
    Chris Armstrong
    @chris-armstrong

    There is an official repo (the web site / test suite ones), but I'm not the maintainer (who hasn't responded to some issues for several years), so I don't know who should take responsibility.

    FWIW, I've forked the official documentation site (so I can host it with TLS) and the JS implementation for GorillaStack, and I'm maintaining my own specification additions in the doc site and the JS implementation.

    See:
    https://github.com/gorillastack/jmespath.js
    https://github.com/gorillastack/jmespath.site

    I should probably fork the test suite and get my additions added to it so that others can add my changes if no-one else is going to maintain the site and test suite.
    Really I just need another major language (probably python) and it should be enough for a decent fork.
    Although I'm not completely sold on the syntax for jmespath, it still is being used in major tooling (like aws-cli) and there is plenty of useful, small language additions that could be made without bloating it out of control.
    Chris Armstrong
    @chris-armstrong
    Chris Armstrong
    @chris-armstrong
    I've also forked the jmespath.test repository, upgraded its test infrastructure and schema, and added the compliance tests for GorillaStack's spec additions (split() function and to_json()/parse_json() proposals (both in our jmespath.js fork)
    https://github.com/GorillaStack/jmespath.test
    (see https://gorillastack-jmespath.netlify.com/proposals for descriptions of those proposals)
    James Saryerwinnie
    @jamesls
    @chris-armstrong I'm the maintainer :(. I'd like to get the project back up and running again.
    James Saryerwinnie
    @jamesls
    I also commented on jmespath/jmespath#65 as well, but I'm very interested in hearing everyone's ideas.
    jdevillard
    @jdevillard
    @jamesls 👍
    Chris Armstrong
    @chris-armstrong
    Thanks @jamesls . I'll make sure to at least get the test cases and proposal writeups for split() and to_json()/parse_json() submitted as PRs soon so they can go into the mainline at some point.
    VF-mbrauer
    @VF-mbrauer
    Somebody who can help me to find a way to have a default value if the value inside the JSON is not there?
    This is my filter:
    contains(roles[], 'admin') && 'Admin' || contains(roles[], 'editor') && 'Editor' || 'Viewer'
    This is the error if element is missing:
    t=2020-03-25T12:30:39+0000 lvl=eror msg="Failed to search user info JSON response with provided path" logger=oauth.generic_oauth attributePath="contains(roles[], 'Admin') && 'Admin' || contains(roles[], 'Editor') && 'Editor' || 'Viewer'" err="Invalid type for: <nil>, expected: []jmespath.jpType{\"array\", \"string\"}"
    Jakub
    @jakubgs
    how does one combine strings ?
    i'm trying locations[].{ x: name+'x' }
    how can I add a string to string?
    or even better, how can I do this: locations[].{ x: name+state } ?
    I've been staring at the docs for a good while and I can't seem to be able to find string operations
    am I blind or does this tool just not support string operations?
    or is there string formatting?
    like locations[].{ x: 'prefix ${name} sufix' } ?
    how can I do that?
    Chris Armstrong
    @chris-armstrong
    You may need to work around the lack of string concatenation with the join() function.
    Jakub
    @jakubgs
    ugh
    I need to stop using ansible, such trash
    hack on top of a hack
    freaking regex_replace to append a suffix to a list
    christ on a bike
    thanks for telling me
    the docs for this tool should have a big banner at the top stating "we don't support string operations, leave"
    gg
    Nathan Winder
    @nathanwinder
    Are there any good examples of non-destructive transforms. I'd like to transform a document retaining its exact structure but adding a property based on the value of another property. A lot of the examples I see result in a subset of the document or transform it from a map to an array etc.
    George Verghese
    @geverghe

    Hey All

    I have the following json snippet:
    [
    {
    "fields": {
    "org.priority": "high"
    },
    "id": 344,
    "relations": null,
    }
    ]

    I am running into challenges when I am trying to extract org.priority field. I have been testing this using https://jsonpath.curiousconcept.com/ . Could someone tell me the right way to do this fetch?

    Greg Wiley
    @aztecrex

    how do you denormalize in JMESPath. For instance if my structure looks like

    {
      "things": [
        {
          "name": "t1",
          "subs": [
            "a",
            "b",
            "c"
          ]
        },
        {
          "name": "t2",
          "subs": [
            "y",
            "z"
          ]
        },
        {
          "name": "t3",
          "subs": []
        },
        {
          "name": "t4"
        }
      ]
    }

    and the output should be one list item per "subs" item:

    [
      ["t1", "a"],
      ["t1", "b"],
      ["t1", "c"],
      ["t2", "y"],
      ["t2", "z"]
    ]

    Can this be done in JMESPath?

    i don't see how to reference the name once i have a flattened list of subs
    Chris Armstrong
    @chris-armstrong
    @aztecrex try to to map the objects to an array of arrays first then flatten it
    Accendit
    @Accendit

    Hi all, I am trying to get all ids from the following data structure:

    [
        {
            "locations": [
                {
                    "id": "1",
                    "name": "Amsterdam"
                },
                {
                    "id": "2",
                    "name": "Rotterdam"
                }
            ],
            "persons": [
                {
                    "id": "3",
                    "name": "John"
                },
                {
                    "id": "4",
                    "name": "Jake"
                }
            ]
        },
        {
            "locations": [
                {
                    "id": "5",
                    "name": "London"
                },
                {
                    "id": "6",
                    "name": "Hamburg"
                }
            ],
            "persons": [
                {
                    "id": "7",
                    "name": "Foo"
                },
                {
                    "id": "8",
                    "name": "Bar"
                }
            ]
        }
    ]

    Id like the output to be:

    [
        [
            "1",
            "2",
            "3",
            "4"
        ],
        [
            "5",
            "6",
            "7",
            "8"
        ]
    ]

    I'm not sure how to achieve this

    Leslie Wilson
    @LeslieWilson
    hello
    hey um, whats like a good tutorial to learn this stuff
    or a textbook or something
    jdevillard
    @jdevillard
    Hello @LeslieWilson have you already take a look at the site https://jmespath.org ?
    tightly-clutched
    @tightly-clutched
    hey, with the new awscli v2 - has anyone heard of an effort to release a compatible version of jpterm (jmespath-terminal)?
    Rajesh Swarnkar
    @RSwarnkar
    Hi There, I need help with this: jmespath/jmespath.py#200
    Rajesh Swarnkar
    @RSwarnkar
    @Accendit Try this [].[locations[].id,persons[].id][][]
    @Accendit Or try this: [ [].[locations[].id][][], [].[persons[].id][][] ] :)
    Jonas Jarutis
    @jarutis

    Hi, is it possible to include missing values in the projection?

    {
      "a": [
        {"b": None},
        {"b": 2}
      ]
    }

    =>

    [None, 2]

    If I search a[].b I get [2].

    Chris Armstrong
    @chris-armstrong
    what about map(&b, a)
    Jonas Jarutis
    @jarutis
    :+1: