Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

About getting webResponse value

I'm using the confluence API. As a response value to the https GET request Suppose you want to get the following data example.

body = {results = [{ope = abc, rest = {user = {results = [{xxx, Id = 12345}]}}, ope = def, rest = {user = {results = [{xxx, Id = 67890}]}}]}

I want to get only Id = 12345 from the above data example. If you specify "body.results.rest.user.results.Id", two Id = 12345 and Id = 67890 will be specified.

If you want to get only the first Id = 12345, you will get it. How should I modify "body.results.rest.user.results.Id"?

1 answer

3 votes
Pramodh M Community Leader Jan 14, 2022

Hi @青山 明 

Use jq tool to extract data from JSON Body

Please find the reference here for documentation

https://stedolan.github.io/jq/manual/#Basicfilters

Thanks,
Pramodh

Pramodh M Community Leader Jan 14, 2022

@青山 明 

In your case, it should be modified as an array to get the data for the first id

I would like you to give a concrete example.

Pramodh M Community Leader Jan 15, 2022

@青山 明 

Would you please give me the exact JSON response? I would give an answer to the requirement you need

Please use the example below.

body = {results = [{ope = abc, rest = {user = {results = [{xxx, Id = 12345}]}}, ope = def, rest = {user = {results = [{xxx, Id = 67890] }]}}]}

How can I modify the smart values below?

{{body.results.rest.user.results.Id}}

Is there anything in my question that doesn't make sense?

Pramodh M Community Leader Jan 15, 2022

@青山 明 

JSON body contains = which shouldn't be

I am confused on how to get the data

Shows some of the "webResponse" information after the response.

I am trying to get data based on that information.

Pramodh M Community Leader Jan 15, 2022

Could you please include the screenshot of the response so that I can have a look at it please

Was self resolved.  thankyou

Like Pramodh M likes this
Pramodh M Community Leader Jan 15, 2022

Could you please include the answer as well so that it can help others in community!!

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Service Management

Next level incident management in Jira Service Management

Hello Atlassian Community! We’re thrilled to announce some exciting changes to incident management in Jira Service Management Cloud, in order to give your teams extra muscle during incidents, and ...

1,739 views 21 12
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