a1mery a1mery - 11 months ago 63
Javascript Question

Convert string into JSON object property

I have a JSON a object named

with a set of properties.
I also have a string:
var customId = Custom_x005f_f3e0e66125c74ee785e8ec6965446416"
I would like to get the value
using my string variable.

Would you know how to do that ?

Please let me know if I'm not clear enough. Thanks.


Answer Source

Just use this:

var string = "Custom_x005f_f3e0e66125c74ee785e8ec6965446416";
vr myVar = Task[string];// Task.Custom_x005f_f3e0e66125c74ee785e8ec6965446416