Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By Purbasha_Chatterjee on
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
Maybe look at this: https:/
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!
Views with format as JSON data document
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.
Again .. Views does not know
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!