I have some string with such format:
aaaaaaaaaaaa //first line
[key = [metadata = 1 metadata = 2 metadata =3] KEY(1) = 100
KEY(2) = 16:30:00 KEY(3) = 2020-12-12 08:30:30 KEY(4) = 0]
I want to get the key value pairs in Json format like
{"KEY(1)":"100", "KEY(2)":"16:30:00", "KEY(3)":"2020-12-12 08:30:30", "KEY(4)":"0"}
I am kind of struggling to deal with the last part, because there could be space also in value like 2020-12-12 08:30:30
, so the only way I can think of is to find the "=", the data between the first space and the second space on the left is the current key, and all rest util the previous "=" is the value for previous key, which is tricky. How should I do it?