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

245
Views
read data json from a specific url

i want do display the data inside this url on my node stand out but it display none , there is something i do wrong in my code

const extractRefDefaultSchema = async (data) => {
const url = "https://mos.esante.gouv.fr/NOS/TRE_R81-Civilite/FHIR/TRE-R81-Civilite/TRE_R81-Civilite-FHIR.json"
https.get(url,(res) => {
    let body = "";
    res.on("data", (chunk) => {
        body += chunk;
    });
    res.on("end", () => {
        try {
            let json = JSON.parse(body);
            // do something with JSON
        } catch (error) {
            console.error(error.message);
        };
    });
}).on("error", (error) => {
    console.error(error.message);
});
console.log("extractRefDefaultSchema");

};

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

0

You can use fetch API for do this :

fetch(url)
.then((res)=> res.json())
.then((json) => {
    let dataJson = JSON.parse(json)
})

about 4 years ago · Juan Pablo Isaza Report

0

You can achieve the same with axios, it would be much simpler.

Code:

let axios = require("axios")
axios.get("https://mos.esante.gouv.fr/NOS/TRE_R81-Civilite/FHIR/TRE-R81-Civilite/TRE_R81-Civilite-FHIR.json").then((res) => {
    let jsonData = res.data
}) 
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!