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

92
Views
Parse html from JSON file

I'm trying to get HTML tags to work in my json-file that i fetch via js.

So i want the return to somehow make the <strong> to work when render it on the page. How would i do that?

Sample of the json:

{
    "header_title": "<strong>test</strong>"
}

JS:

const newTranslations = await fetchTranslationsFor(
    newLocale,
);

async function fetchTranslationsFor(newLocale) {
    const response = await fetch('/lang/en.json');
    return await response.json();
}

To render it i do like so: pseudo.

element.innerText = json.myprop;
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Change innerText to innerHTML. When you use the text method, it escapes the html characters. Innerhtml renders the exact html.

element.innerHTML = json.myprop;
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!