AnsweredAssumed Answered

JSON.parse - Passing variable into query.outfields.

Question asked by KeitherJ on Jan 27, 2015
Latest reply on Jan 28, 2015 by KeitherJ



I am trying to pass a variable into query.outfields.


When it is hard coded it works. Coming in as an object.

query.outFields = ["OBJECTID", "NAME"];


Passing in the JSON variable does not work.

query.outFields = JSON.parse(FieldNames);    //   "['OBJECTID', 'Name']" (value in query parameter through FFox)

I am getting a JSON error in the browser that says it cannot recognize the square bracket [ .


Any suggestions on how to pass in JSON variables into query.output would be great.