1

I am new to python and experimenting with JSONs and here I am trying to pick values(member list) from a JSON but I have multiple clusters to pick the members from:

with open("/some/path/example.json") as js:
   dcJson=json.load(js)
   i=1
   print (dcJson["search"]["nodes"]["cluster{}"]["members"]).format(i)

How to write something so that the call will be dcJson["search"]["nodes"]["cluster1"]["members"]

Thanks very much!

1 Answer 1

2
dcJson["search"]["nodes"]["cluster{}".format(i)]["members"]
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.