How can I get all the terms of my custom taxonomy in a JSON (sorted and able to filter)

Hello.

I have a WordPress that has a custom post type and that custom post type has a custom taxonomy.

The taxonomy of this custom post type is very large, it has many terms with many parents and children.

I would like to be able to organize the hierarchy of custom taxonomy terms and I guess the best way would be in a JSON I guess.

​

**This is because I want to do something like this:**
\- Home: Grid showing the parent terms.
\- Custom taxonomy archive page (when clicking on a grid item): Show accordions of all its children and sub children I think if I manage to make a structure in JSON it might be easier.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer