what am I doing wrong in creating the json object here
I have a javaScript array the data looks like this
0
feature "Point 1"
pinColor "red"
1
feature "Point 2"
pinColor "blue"
2
feature "Point 3"
pinColor "green"
3
feature "Point 4"
pinColor "yellow"
I use the following code to try to create the json object
What I get is
[object Object][object Object][object Object]
I know that what I want to get is
{"feature":"p1" , "icon":"red"},{ "feature":" p2", "icon":"blue"}, ...
Once I get past this part I can ask my next basic question.
I have a javaScript array the data looks like this
0
feature "Point 1"
pinColor "red"
1
feature "Point 2"
pinColor "blue"
2
feature "Point 3"
pinColor "green"
3
feature "Point 4"
pinColor "yellow"
I use the following code to try to create the json object
Code:
var featureAttrib = [] for (var i = 0; i < fArray.length; i++ ) { featureAttrib += {"FEATURE": fArray[i].feature, "ICON": fArray[i].iconColor }; }
[object Object][object Object][object Object]
I know that what I want to get is
{"feature":"p1" , "icon":"red"},{ "feature":" p2", "icon":"blue"}, ...
Once I get past this part I can ask my next basic question.
Comment