Variable in Object-Name

I got a little brainbug, and I hope somebody could help me: I cant set a variable as a “part of the object-path”:
(last 2 lines)

var yzClick = function(args) {
       console.log(JSON.stringify(args.data));  // OUTPUT: "abc123"
	var yzfield = args.data
	return fetch( YZ_URL2.value)
		.then(function(response) { return response.json(); })
		.then(function(responseObject) {
			console.log(yzfield);  // OUTPUT: abc123
			console.log( JSON.stringify(responseObject.fields[0].yzfield)); // OUTPUT: undefined
			console.log( JSON.stringify(responseObject.fields[0].abc123)); //OUTPUT: {"name1":"test","name2:"test2"}
		});
	}

I tried different things like responseObject.fields[0].${yzfield} or responseObject.fields[0] + yzfield ( I know it was stupid)

Any help would be AWESOME :slight_smile:

Gratefully

John

Could it be responseObject.fields[0][yzfield]?

Love you!!

Couldn’t test it yet, but im sure it will work. (gonna test it tonight, and report back to you asap)

Thank you very much Uldis!!! You always are soo kind and helpful to the community! I read uncountable posts from you, solving and simplifying all problems we got. Just wanted to say a bit more than “thank you” this time, but you deserve much more.

Gratefully

John

Thanks for the kind words, that means a lot. Happy to help!

Sorry for the late response, I fall asleep yesterday night ^^

It worked! (Of course :wink: )

Thank you soo much!!!