a1mery a1mery - 20 days ago 5
Javascript Question

Convert string into JSON object property

I have a JSON a object named

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

Would you know how to do that ?

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

Regards,

Answer

Just use this:

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