I've got a long string. This string contains a list, like such example
'[{"ex1": 0, "ex2":1}, {"ex3": 2, "ex4":3}]'
I can use json5.loads
and then get the first element by using [0]
on the list, but json5.loads
takes a long time for longer strings. Is there a way to get just the first element without loading the entire list? (in this example it would be {"ex1": 0, "ex2":1}
. Splitting by commas doesn't work for me since there are commas contained in dictionaries in the list. Thanks.