Reputation: 12743
I didn't find the keyword for google...
My Problem is
let's have a json array
{
"a":"b",
"c" : "d",
"api" :
{
"name":"listOfNetwork",
"param" :['xyz','xyz1']
}
}
Now i have a javascript method
function listOfNetwork(param1, param2) //name-of-api, params
{
// do something.
}
how to invoke this function by retrieving the name and parameters from JSON.
Please help
Upvotes: 2
Views: 77
Reputation: 8243
window[json.api.name].apply(this, json.api.param)
Thats all.
Upvotes: 6