0

I want to count and list every JSON item by numbers. Is it possible to count the item by the { }? For example, it will search for the first {} and set it as the first item and so on.

enter image description here

Expected output: enter image description here

Code

  tmp = json.dumps(file_data, ensure_ascii=False, indent="\t") + "\n" + "\n"

  reviewjson.insert(END, tmp)


1 Answer 1

2

you can convert your json to python dict easily, that should get you job done

tmp_dict = json.loads(tmp)

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

3 Comments

It doesnt show in proper format, i want it to add a counting number for each of the data. For example 1[json], 2[json] and so on.
@Johnnyyy Once you have it as a Python object you have plenty of tools to format it any way you want. Counting {s will get very difficult if your data has nested { } in it.
@BoarGules Alright thanks for the explanation. I will worked on python object instead

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.