0

What's wrong with console.log ? :D json_data is an JSON Object

var json_data = {'title':'X-test', categories:['abc','def','ghi']}

After it's declaration I am adding more properties:

 json_data.xAxis = {
        categories: ['abc','def','ghi'],
        labels: {
          enabled: 1   // <----  notice that property enabled becomes 1 
        }
      };

And then

console.log(json_data);

output:

categories: Array[7]
title: "X-test"
xAxis: Object
    categories: Array[7]
    labels: Object
        enabled: false       // <--- it's crucial!!  :)

So next let's make a more specific dump:

console.log(json_data.xAxis.labels);

{enabled: 1} <---- So the dump of only labels is correct

The first dump should have enabled:1, not false.

Why console.log() does that to me? :D

EDIT:

The variable json_data is set in $.each() few times - maybe it's because of that and lazynes of a console.log :)

Mr.TK
  • 1,743
  • 2
  • 17
  • 22

1 Answers1

1

Try

console.log(JSON.stringify(json_data));
  • It's not the answer for my question but thank You for making me see that enabled is somehow true in this whole json_data variable. :D – Mr.TK Feb 09 '15 at 10:33