2

I am trying to return a taxonomy tree in the JSON format but the issue is that I would like to have it nested based on the depth of the term, like the following format: What is the easiest way to do this?

 {
            label: 'term1',
            children: [
                { label: 'term1.1' },
                { label: 'term1.2',
                  children: [label: 'term1.2.1'] }
            ]
        },
        {
            label: 'term2',
            children: [
                { label: 'term2.1' }
            ]
        }
    ];

Thanks,

2
  • So, what is your question and what have you tried so far?
    – user7667
    Commented Jul 18, 2012 at 20:16
  • sorry the question now is clarified. I have tried to modify and the algorithm mentioned in the following link but so far no luck. drupal.org/node/223675
    – jax
    Commented Jul 18, 2012 at 20:49

0

Browse other questions tagged or ask your own question.