Sign in to follow this  
JonathansCorner.com

Json Not Working

Recommended Posts

I am trying to convert XML to JSON for populating a graph. My working XML is:

 

<chart caption="Volume 2010 vs. 2011" xAxisName="Month" yAxisName="USD" showValues="0" numberPrefix="{:content:}quot;>
       <categories>
               <category label="Current" />
               <category label="February" />
               <category label="January" />
               <category label="December" />
               <category label="November" />
               <category label="October" />
       </categories>

       <dataset seriesName="2010" color="4060af">
               <set value="1" />
               <set value="2" />
               <set value="1" />
               <set value="2" />
               <set value="1" />
               <set value="2" />
       </dataset>

       <dataset seriesName="2011" color="622567">
               <set value="3" />
               <set value="4" />
               <set value="3" />
               <set value="4" />
               <set value="3" />
               <set value="4" />
       </dataset>
</chart>

 

 

The present JSON results in "Invalid data" being displayed. Going off of http://www.fusioncha...ry.asp?Column3D I have:

 

{
 "chart": {
         "palette": "5",
         "caption": "Volume 2010 vs. 2011",
         "xaxisname": "Month",
         "yaxisname": "USD",
         "numberprefix": "{:content:}quot;,
         "rotatevalues": "1",
         "placevaluesinside": "1",
         "forceyaxisvaluedecimals": "1",
         "yaxisvaluedecimals": "2",
         "showvalues": "0",
         },[{[{
                 "label": "October",
                 },{
                 "label": "November",
                 },{
                 "label": "December",
                 },{
                 "label": "January",
                 },{
                 "label": "February",
                 },{
                 "label": "Current",
                 },]
         },][{
         "seriesname": "2010",
         "color": "4060af",
         "showvalues": "0",[{
                 "value": "1",
                 },{
                 "value": "2",
                 },{
                 "value": "1",
                 },{
                 "value": "2",
                 },{
                 "value": "1",
                 },{
                 "value": "2",
                 },]
         },{
         "seriesname": "2011",
         "color": "622567",
         "showvalues": "0",[{
                 "value": "3",
                 },{
                 "value": "4",
                 },{
                 "value": "3",
                 },{
                 "value": "4",
                 },{
                 "value": "3",
                 },{
                 "value": "4",
                 },]
         },]
 }

 

What is wrong with this JSON?

 

Thanks,

Jonathan

Edited by JonathansCorner.com

Share this post


Link to post
Share on other sites
Guest Angie

Hi,

 

Welcome to FusionCharts Forum!smile.gif

 

Please try the modified JSON code below:

 

 

{

"chart": {

"caption": "Volume 2010 vs. 2011",

"xaxisname": "Month",

"yaxisname": "USD",

"showvalues": "0",

"numberprefix": "$"

},

"categories": [

{

"category": [

{

"label": "Current"

},

{

"label": "February"

},

{

"label": "January"

},

{

"label": "December"

},

{

"label": "November"

},

{

"label": "October"

}

]

}

],

"dataset": [

{

"seriesname": "2010",

"color": "4060af",

"data": [

{

"value": "1"

},

{

"value": "2"

},

{

"value": "1"

},

{

"value": "2"

},

{

"value": "1"

},

{

"value": "2"

}

]

},

{

"seriesname": "2011",

"color": "622567",

"data": [

{

"value": "3"

},

{

"value": "4"

},

{

"value": "3"

},

{

"value": "4"

},

{

"value": "3"

},

{

"value": "4"

}

]

}

]

 

Hope this helps.smile.gif

Share this post


Link to post
Share on other sites
Guest Angie

Hi,

 

We are glad to know that you have managed to solve your problem.

 

Keep FusionCharting!biggrin.gif

Share this post


Link to post
Share on other sites

CLARIFICATION: I haven't solved my problem. The forum munged my posted code and I was trying to explain what the original version was.

 

My problem is unsolved now.

Hi,

 

We are glad to know that you have managed to solve your problem.

 

Keep FusionCharting!biggrin.gif

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this