Filtering list of objects with json values using JMESPATHListing instance name among other data with aws-cli 1.3.6JMESPath nested OR statementJMESPath JSON filter with multiple matchesFilter output based on the existence of multiple key/value pairsFilter object by property and select with key in jmespathUsing keys from the json src doc in a multiselect hash with JmespathHow do i filter on ansible stat existence flags?How to take key value pairs and turn them into an array of objects using JMESPathwp rest api filter nested array jmespathHow to merge JSON using JMESPATH?

Is it true that, "just ten trading days represent 63 per cent of the returns of the past 50 years"?

What is the meaning of "heutig" in this sentence?

Manager encourages me to take day of sick leave instead of PTO, what's in it for him?

Can the U.S. president make military decisions without consulting anyone?

Sparse columns, cpu time & filtered indexes

What are these ingforms of learning?

Was there a trial by combat between a man and a dog in medieval France?

Social leper versus social leopard

Hiking with a mule or two?

Why is there not an optimal solution for a MIP?

Why does NASA publish all the results/data it gets?

Going to France with limited French for a day

Hilbert's hotel, why can't I repeat it infinitely many times?

The quicker I go up, the sooner I’ll go down - Riddle

Do the villains know Batman has no superpowers?

How do I deal with too many NPCs in my campaign?

Idiom for "I came, I saw, I ate" (or drank)

Is It Possible to Have Different Sea Levels, Eventually Causing New Landforms to Appear?

Can this word order be rearranged?

Guitar tuning (EADGBE), "perfect" fourths?

In a folk jam session, when asked which key my non-transposing chromatic instrument (like a violin) is in, what do I answer?

How much Damage can be done with "just" heating matter?

A drug that allows people to survive on less food

Is it a good idea to leave minor world details to the reader's imagination?



Filtering list of objects with json values using JMESPATH


Listing instance name among other data with aws-cli 1.3.6JMESPath nested OR statementJMESPath JSON filter with multiple matchesFilter output based on the existence of multiple key/value pairsFilter object by property and select with key in jmespathUsing keys from the json src doc in a multiselect hash with JmespathHow do i filter on ansible stat existence flags?How to take key value pairs and turn them into an array of objects using JMESPathwp rest api filter nested array jmespathHow to merge JSON using JMESPATH?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








3















I have a JSON and I need to select the value of the persons roles using JMESPATH. I can do it with only one and static id, like roles[?id=='1324'], but I can't do with a list of roles ids and selected from the JSON. I tried to do that with: roles[?id==person[ * ].role[ * ].id[ ]] and using pipe, but without any result. Below an example of my JSON.




"person":[

"id":"999999999",
"role":[

"id":"1324",
"name":"Test"
,

"id":"1578",
"name":"Test 2"

]
,

"id":"888888888",
"role":[

"id":"1234",
"name":"Test"
,

"id":"1678",
"name":"Test 2"

]

],
"roles":[

"id":"1234",
"value":"$945.00"
,

"id":"1324",
"value":"$1245.00"
,

"id":"1578",
"value":"$3245.00"
,

"id":"1678",
"value":"$4245.00"

]










share|improve this question
























  • You can't do it in JMES Path use jq. It's impossible because once you're in a node you can't go back, here you enter in the roles node and then you try to search something in the person node, but once you get in the roles node JMES Path ignore the other node so in your filter your query will never get any results. And more than that, I think you can't use any query in the filter, I don't know why.

    – bosskay972
    Jul 22 at 14:04


















3















I have a JSON and I need to select the value of the persons roles using JMESPATH. I can do it with only one and static id, like roles[?id=='1324'], but I can't do with a list of roles ids and selected from the JSON. I tried to do that with: roles[?id==person[ * ].role[ * ].id[ ]] and using pipe, but without any result. Below an example of my JSON.




"person":[

"id":"999999999",
"role":[

"id":"1324",
"name":"Test"
,

"id":"1578",
"name":"Test 2"

]
,

"id":"888888888",
"role":[

"id":"1234",
"name":"Test"
,

"id":"1678",
"name":"Test 2"

]

],
"roles":[

"id":"1234",
"value":"$945.00"
,

"id":"1324",
"value":"$1245.00"
,

"id":"1578",
"value":"$3245.00"
,

"id":"1678",
"value":"$4245.00"

]










share|improve this question
























  • You can't do it in JMES Path use jq. It's impossible because once you're in a node you can't go back, here you enter in the roles node and then you try to search something in the person node, but once you get in the roles node JMES Path ignore the other node so in your filter your query will never get any results. And more than that, I think you can't use any query in the filter, I don't know why.

    – bosskay972
    Jul 22 at 14:04














3












3








3


1






I have a JSON and I need to select the value of the persons roles using JMESPATH. I can do it with only one and static id, like roles[?id=='1324'], but I can't do with a list of roles ids and selected from the JSON. I tried to do that with: roles[?id==person[ * ].role[ * ].id[ ]] and using pipe, but without any result. Below an example of my JSON.




"person":[

"id":"999999999",
"role":[

"id":"1324",
"name":"Test"
,

"id":"1578",
"name":"Test 2"

]
,

"id":"888888888",
"role":[

"id":"1234",
"name":"Test"
,

"id":"1678",
"name":"Test 2"

]

],
"roles":[

"id":"1234",
"value":"$945.00"
,

"id":"1324",
"value":"$1245.00"
,

"id":"1578",
"value":"$3245.00"
,

"id":"1678",
"value":"$4245.00"

]










share|improve this question














I have a JSON and I need to select the value of the persons roles using JMESPATH. I can do it with only one and static id, like roles[?id=='1324'], but I can't do with a list of roles ids and selected from the JSON. I tried to do that with: roles[?id==person[ * ].role[ * ].id[ ]] and using pipe, but without any result. Below an example of my JSON.




"person":[

"id":"999999999",
"role":[

"id":"1324",
"name":"Test"
,

"id":"1578",
"name":"Test 2"

]
,

"id":"888888888",
"role":[

"id":"1234",
"name":"Test"
,

"id":"1678",
"name":"Test 2"

]

],
"roles":[

"id":"1234",
"value":"$945.00"
,

"id":"1324",
"value":"$1245.00"
,

"id":"1578",
"value":"$3245.00"
,

"id":"1678",
"value":"$4245.00"

]







jmespath






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 28 at 15:20









Hugo FerreiraHugo Ferreira

161 bronze badge




161 bronze badge















  • You can't do it in JMES Path use jq. It's impossible because once you're in a node you can't go back, here you enter in the roles node and then you try to search something in the person node, but once you get in the roles node JMES Path ignore the other node so in your filter your query will never get any results. And more than that, I think you can't use any query in the filter, I don't know why.

    – bosskay972
    Jul 22 at 14:04


















  • You can't do it in JMES Path use jq. It's impossible because once you're in a node you can't go back, here you enter in the roles node and then you try to search something in the person node, but once you get in the roles node JMES Path ignore the other node so in your filter your query will never get any results. And more than that, I think you can't use any query in the filter, I don't know why.

    – bosskay972
    Jul 22 at 14:04

















You can't do it in JMES Path use jq. It's impossible because once you're in a node you can't go back, here you enter in the roles node and then you try to search something in the person node, but once you get in the roles node JMES Path ignore the other node so in your filter your query will never get any results. And more than that, I think you can't use any query in the filter, I don't know why.

– bosskay972
Jul 22 at 14:04






You can't do it in JMES Path use jq. It's impossible because once you're in a node you can't go back, here you enter in the roles node and then you try to search something in the person node, but once you get in the roles node JMES Path ignore the other node so in your filter your query will never get any results. And more than that, I think you can't use any query in the filter, I don't know why.

– bosskay972
Jul 22 at 14:04













0






active

oldest

votes














Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);














draft saved

draft discarded
















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55401222%2ffiltering-list-of-objects-with-json-values-using-jmespath%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55401222%2ffiltering-list-of-objects-with-json-values-using-jmespath%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript