Skip to content

Extracting price for a product #1436

Answered by mikefarah
arthef asked this question in Q&A
Discussion options

You must be logged in to vote

Sure thing:

yq '.catalog.plans.plan[] | select(.product == "Personal") | .finalPhase.recurring.recurringPrice.price.value' file.yaml

Explanation:

  • dive into the array .catalog.plans.plan[] - the [] at the end recurses into all the array children
  • select the ones with personal product select(.product == "Personal")
  • dig into that child to get the value.

Hope it makes sense!

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by arthef
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants