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

603
Views
How can i get json in axios with react native?

I'm trying to get json in axios

but if i use my code this error and warning occured

How can i get response.json ??

enter image description here

response.json is not a function

this is my code

      //    url="https://yts.lt/api/v2/list_movies.json?sort_by=like_count&order_by=desc&limit=5"
            
            url is props

     useEffect(() => {
        axios
          .get(url)
          .then((response) => response.json())
          .then((json) => {
            console.log('json', json);
            setData(json.data.movies);
          })
          .catch((error) => {
            console.log(error);
          });
      }, []);
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

The response object from axios stores its data in response.data.

useEffect(() => {
        axios
          .get(url)
          .then((response) => {
            const json = response.data;
            console.log('json', json);
            setData(json.data.movies);
          })
          .catch((error) => {
            console.log(error);
          });
      }, []);
about 4 years ago · Juan Pablo Isaza Report

0

Use this:

useEffect(() => {
        axios
          .get(url)
          .then((response) => response.data)
          .then((json) => {
            console.log('json', json);
            setData(json.data.movies);
          })
          .catch((error) => {
            console.log(error);
          });
      }, []);
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!