0

I am trying to extract "Automation Admin" from the below JSON output I am getting but it gives me JSONObject["Name"] not found exception.

JSON Result

Below is the code snippet. Code snippet

I tried replacing ownerName = json.getJSONArray("records").getJSONObject(i).getString("Name"); with ownerName = json.getJSONArray("records").getJSONObject(i).getString("Owner"); but even that fails. I am able to print values of OwnerId, FirstName etc but not Name. How can I extract 'Automation Admin'?

2
  • 2
    It's not a field of the root record object, but the Owner item - so json.getJSONArray("records").getJSONObject(i).getJSONObject("Owner").getString("Name") or something similar Commented Feb 13, 2020 at 17:42
  • That worked. You saved my day. Thanks :) Commented Feb 13, 2020 at 17:44

1 Answer 1

1

You have to use ownerName = json.getJSONArray("records").getJSONObject(i).getJSONObject("Owner").getString("Name")

Sign up to request clarification or add additional context in comments.

Comments

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.