0

I have an API request that produces the final JSON array. How can i get out this:

"Key":"PCP","Payment":170.08

From the below array result:

{"VehicleResults":[{"Id":"0","FinanceProductResults":[{"Term":36,"AnnualMileage":10000,"Deposits":1000,"ProductResults":[{"Key":"PCP","Payment":170.08},{"Key":"HP","Payment":279.37}]}]}]}

It is probably easy, but I don't know JQuery that well unfortuantely.

1 Answer 1

2

You don't even need jQuery for do what you need. You just have to save your Json answer in a variable and go through his properties to get the one that you need. For instance:

var myAnswer = {"VehicleResults":[{"Id":"0","FinanceProductResults":[{"Term":36,"AnnualMileage":10000,"Deposits":1000,"ProductResults":[{"Key":"PCP","Payment":170.08},{"Key":"HP","Payment":279.37}]}]}]}

myAnswer.VehicleResults[0].FinanceProductResults[0].ProductResults[0]
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you Brank! Works perfectly!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.