Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

122
Views
JSON to HTML output using TMDB API

I am using the fetch API to grab data from TMBD which I can display in the console like this...

fetch('https://api.themoviedb.org/3/movie/778?api_key=1234&append_to_response=videos,credits')
    .then(res => res.json())
    .then((out) => {
        console.log('Output: ', out);
}).catch(err => console.error(err));

The JSON looks like this...

{
"backdrop_path": "/8gSU1tLLdE5TWbcg9YDnR2lD0sO.jpg",
"belongs_to_collection": null,
"budget": 0,
"genres": [
    {
        "id": 99,
        "name": "Documentary"
    }
],
"homepage": "https://www.focusfeatures.com/roadrunner",
"id": 642732,
"imdb_id": "tt14512538",
"original_language": "en",
"original_title": "Roadrunner: A Film About Anthony Bourdain",
"overview": "An intimate, behind-the-scenes look at how an anonymous chef became a world-renowned cultural icon.",
"production_countries": [
    {
        "iso_3166_1": "US",
        "name": "United States of America"
    }
]

}

I now need to drop this into some simple HTML. For example, some variables that are named 'original_title' and 'overview', each in their own div...

<div>title outputs here</div>
<div>overview outputs here</div>

I know this is very simple, but I can't get the JS to work. Any help appreciated.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

This is a sample code for your reference.

let out={
  "adult": false,
  "backdrop_path": "/fCayJrkfRaCRCTh8GqN30f8oyQF.jpg",
  "belongs_to_collection": null,
  "budget": 63000000,
  "genres": [
    {
      "id": 18,
      "name": "Drama"
    }
  ],
  "homepage": "",
  "id": 550,
  "imdb_id": "tt0137523",
  "original_language": "en",
  "original_title": "Fight Club",
  "overview": "A ticking-time-bomb insomniac and a slippery soap salesman channel primal male aggression into a shocking new form of therapy. Their concept catches on, with underground \"fight clubs\" forming in every town, until an eccentric gets in the way and ignites an out-of-control spiral toward oblivion.",
  "popularity": 0.5,
  "poster_path": null
};

function go(){
  let overViewDiv=document.getElementById("overViewDiv");
  let originalTitleDiv=document.getElementById("originalTitleDiv");
  
  overViewDiv.innerHTML=out.overview;
  originalTitleDiv.innerHTML=out.original_title;
}
Over View:
<div id="overViewDiv"></div>
Original Title:
<div id="originalTitleDiv"></div>
<button onclick="go()">Go</button>

In your case,

  1. Set the id for each div as the sample code.

  2. And replace :

     console.log('Output: ', out);
    

    with :

       let overViewDiv=document.getElementById("overViewDiv");
       let originalTitleDiv=document.getElementById("originalTitleDiv");
    
       overViewDiv.innerHTML=out.overview;
       originalTitleDiv.innerHTML=out.original_title;
    
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!