Hi,

I am a beginner in Drupal 7 and I am trying to build a custom JSON by using the taxonomy terms. I have implemented the taxonomy terms with parent child relationship and I want to build the same for json. For example, I have a term term Activism which a parent for several other term. Thus, I am looking for a JSON something like this.

{
 "name":"Terms",
 "children" : [
{
  "name":"Activism",
  "children" : [{
    "name" : "American Civil Liberties Union (ACLU)",
    "size" : "1"
  },
   {
    "name" : "Bertrand Russell",
    "size" : "1"
   }]
 }]
}

Can anyone help how to proceed with it. It seems the JSON data document does not provide such relational structuring.

Comments

Stefan Lehmann’s picture

Maybe look at this: https://www.drupal.org/node/2468325

Also it might be worth to mention which custom module you are actually using / have a question about if you are having a specific question so people don't have to guess what you're trying to do..

I like cookies!

Purbasha_Chatterjee’s picture

I am currently using Views with format as JSON data document. I am unable make a nested parent child relation in JSON between the taxonomy terms. Certain taxonomy terms are declared as a child of the existing terms. I want to know if Views have certain features for JSON data document format to comprehend with the above requirement. If not, I am looking forward for ways through php embedded in drupal.

Stefan Lehmann’s picture

Again .. Views does not know about JSON data document as this is a custom module you installed. If the module does not provide that functionality, Views certainly doesn't.

I like cookies!