node.js - convert a string to JSON Object with same name (Need this for some sort of dynamic code in js) -


var objname = "person";   //if assign "institute" need institute json object //i have global person json many attributes. var thisobj = objname.toobject(); //need of kind  //i know eval can used, checking other better way this. 

please advise if there better way convert string object of name in nodejs, sails js

it not technically possible in es5 javascript want without use of eval. have eluded to, not idea use eval in situation (or pretty all). alternative such david suggested go-to now.


Comments

Popular posts from this blog

c++ - rosrun via ssh doesnt start a node properly -

android - questions about switching from C2DM to GCM -

How to resolve Delphi error: Incompatible types: 'PWideChar' and 'Pointer' -