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' }


  • So, what is your question and what have you tried so far? – user7667 Jul 18 '12 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 Jul 18 '12 at 20:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.