简体   繁体   中英

How to display the json data in drupal 8 page?

How to display the json data in drupal 8 page?

Hi Team, I am looking out for possible solutions to display the data from external API in a drupal page.

  1. calling the API on page load.
  2. API call results a json array
  3. need to pick the data from the result and display in the following format in drupal 8 page. enter image description here

Please suggest the best approach for this requirement. Note: we are not supposed to store the fetch data in drupal db. we need to use drupal page to display the content alone.

You'll need to build a custom module to:

  1. Add a service which will fetch the data from your API call using \\GuzzleHttp\\Client::request()
  2. Create a custom route which will use the service and return a renderable array of data
  3. Create a template which will be used by your custom route to format the data as you want it to be displayed

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM