After making a post and receiving the return I want to treat him.
lambdaGetDependencies
returns a JSON and I need specific values from the JSON, that's what I try to do inside the cycle.
if CLUSTER_ENDPOINT and CLUSTER_PORT:
data = lambdaGetDependencies(resource)
else:
print("provide CLUSTER_ENDPOINT and CLUSTER_PORT environment variables")
elements = data['result']['data']['@value']
dependencies = [None] * len(elements)
count = 0
j = 0
for i in elements:
while j < len(i['@value']):
x = {i['@value'][j]: i['@value'][j+1]['@value'][0]}
c.append(x)
dependencies[count] = i['@value'][j+1]['@value'][0]
count += 1
j += 1
return json.dumps(c)
The problem is that I get string indices must be integers
on the line:
x = {i['@value'][j]: i['@value'][j+1]['@value'][0]}
and I don't get why. Any ideas?