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

121
Views
Accessing specific data from a json object in react native

I am trying to get a single value from a json object. E.g to get only 'authors' not the whole object

Here is my current code:

 const getArticlesFromApi = async () => {
    let response = await fetch(
      'http://api.mediastack.com/v1/news'
    )
    let test = await response.json();
    console.log(test)
  }

What can be done to the above code to achieve the result I want and here is the current output:

    Object {
      "author": "OdAdmin",
      "category": "general",
      "country": "us",
      "description": "New Delhi: Overcoming all hurdles and finding new solutions, Indian Railways is continuing its journey of bringing relief by delivering Liquid Medical Oxygen(LMO) to various states across the country. Oxygen Expresses crossed mark of 26000 MT of LMO delivery in service to the Nation. So far, Indian Railways has delivered more than 26891 MT of […]",
      "image": null,
      "language": "en",
      "published_at": "2021-06-07T15:37:44+00:00",
      "source": "orissadiary",
      "title": "Oxygen Expresses deliver more than 26891 MT of LMO to the Nation",
      "url": "https://orissadiary.com/oxygen-expresses-deliver-more-than-26891-mt-of-lmo-to-the-nation/",
    },
    Object {
      "author": "Graham Gremore",
      "category": "general",
      "country": "us",
      "description": "We've officially lost count of how many times Rand Paul has claimed to be the victim of some sort of foiled assassination plot.",
      "image": null,
      "language": "en",
      "published_at": "2021-06-07T15:39:05+00:00",
      "source": "queerty",
      "title": "Rand Paul claims his life is in danger (again), says “I don’t know what the world’s coming to!”",
      "url": "https://www.queerty.com/rand-paul-claims-life-danger-says-dont-know-worlds-coming-20210607",
    },
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

If the api does not provide any option for filtered or rather projected output like you wanted as 'authors', you need to do the post processing of the test variable by any kind of iteration method.

For example let authors = test.map( x => x.author )

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!