a1mery a1mery - 1 year ago 75
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
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download