Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,300,102
Community Members
 
Community Events
165
Community Groups

How to parse json with specified key value using SIL

Edited

Below is the sample of the JSON. I want to get the id and workspaceId with the given value of jirakey using SIL. 

In this given JSON, how to get id and workspaceId with "jirakey=MD" ?

 

--------------------------------------------------

{
"success": true,
"message": null,
"data": [
{
"id": "AAAAAAAAAAAAAAA",
"workspaceId": "BBBBBBBBBBBBBBBB",
"name": "name01",
"description": null,
"jiraKey": "MD",
"platform": "Jira",
"workspaceName": "workspace1"
},
{
"id": "CCCCCCCCCCCCCCCCCC",
"workspaceId": "dddddddddddddddd",
"name": "name02",
"description": "mydescription",
"jiraKey": null,
"platform": "Local",
"workspaceName": "workspace2"
}
]
}

 

---------------------------------------------------

In JMeter, there's way as following:

$.data[?(@.jiraKey=="MD")].id
$.data[?(@.jiraKey=="MD")].workspaceId

How about in SIL? 

 

3 answers

Hi @MeterSphere Demo

you should use fromJson to get the json like an object and then you should get the property like it showed in this documentation page.

Hi @MeterSphere Demo,

Just a thing about your json: there is an issue due to the comma near "workspace1" and near "workspace2".
I recommend you to use a Json validator like: JSONLint.

Thank you @Andrea Pannitti for pointing it out. I corrected the json. 

This was because I removed part of the content in the original json. 

removing the wrong comments

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Apps & Integrations

Marketplace Partner Spotlight: AppLiger

This month the spotlight is on AppLiger. We caught up with Pavel Pavlovsky, CEO and Product Manager, to learn how the company started and what fuels the team's creativity.    Atlassian:...

396 views 0 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you