Skip to main content
Question

How to access JSON object by key in Pipeline?

  • November 2, 2021
  • 0 replies
  • 113 views

I have mapped an object in my pipeline that grabs 4th and 5th object value, however, the order of the objects will not always be the same based on values we're passing into the pipeline. Is there a way to grab the value of an object based on the name of the key? For example, I would rather grab the value "vid" or "sid", but I understand those are values of the object. 

I can get the vid value using: {{a.body_json.meta_data.4.value}}

It's just not consistent, because it sometimes grabs the 5th or 6th object value based on what we pass. I was hoping there was a way to pull by key, but I couldn't get the syntax to work.

I've tried the following for sid, but had no luck:
{{a.body_json.sid}}
{{a.body_json.meta_data.sid}}
{{a.body_json.meta_data.0.sid}}
{{a.body_json.meta_data.5.sid}}

Help appreciated. Thanks!


------------------------------
Quincy Adam
------------------------------
This topic has been closed for replies.

JimHarrison
Forum|alt.badge.img+18
  • Registered
  • November 3, 2021
It sounds like you're looking to search an array using a regex. 

If the above is true, here are my 30 second thoughts for options:
1. maintain the order of the array and include nils or blanks
2. add processing to the pipeline to perform a search for each filter

I would say maintaining an ordered array with nils is the preferred method.

Do I know how? Nope.

Curious to hear what you discover and results.

------------------------------
Jim Harrison
transparency = knowledge + understanding : The Scrum Dudes
------------------------------