How to generate JSON from the database

I have created custom plugin similar to blog plugin but to showcase my portfolio and want apply skeleton content loading feature. I googled the techniques and one of the example resolve around generating JSON file and use Javascript to fetch the JSON and CSS to create the skeleton content loader to give users the impression that the content is loading onto the page?

What’s the best method to generate JSON file from the database such as image, title etc ?

Hi and welcome @jubbot,

Assuming this is a new website and you are using v3.x, take a look at the API resource documentation:

This lets you convert CMS components to JSON responses and is perfect for designing an endpoint you can use for the skeleton content loading feature.

I hope this helps!

Thank for the reply, I am currently using 2.2.25 version at the moment. Is 3.0 still in beta phase?

That’s right, it is in beta and will be stable in a few months. It is generally stable enough to use for new websites, though, with the exception of sites that require incompatible plugins.

I will give a read through the API endpoint, hopefully the plugins that I rely on update to work with 3.0

1 Like