DEV Community

Cover image for How can I format WPgetAPI Plugin Output in WordPress to display data in a table instead of JSON format?
Muhammad Ali
Muhammad Ali

Posted on

How can I format WPgetAPI Plugin Output in WordPress to display data in a table instead of JSON format?

Details:
I have a WordPress website where I'm using the "WPgetAPI" plugin to connect to Rapid API and display data on my pages. The plugin provides a short code to display the data, but it's currently showing up in JSON format. I'm looking for a way to format the data into a table on my website.

Code:
Here's the code snippet I'm currently using:

<?php

$data = wpgetapi_endpoint( 'ott_details', 'ott_details', array('debug' => false) );

var_dump($data);

echo $data['title']
?>

Issue:
Despite my efforts, the data is still displaying in JSON format, and I can't figure out how to get it to display in a table.

Environment:

WordPress version: [6.4.1]
WPgetAPI plugin version: [2.2.3]

Attempts to Solve:
I've checked the WPgetAPI and Rapid API documentation without finding a solution. I've also tried tweaking the PHP code, but with no success.

Expected Outcome:
I expect the data to be displayed in a table on my website, showing specific fields.

Top comments (1)

Collapse
 
muhammad_ali121 profile image
Muhammad Ali

Image description