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

191
Views
How do I make a form using parsed JSON data?

(I haven't decided what exactly the questions and options are going to be yet). You can see below the parse object I've tried to build the quiz using form. When I try to run this code nothing shows up. What am I doing wrong? I really, really appreciate any help.

const json = 
  { quiz: 
    { q1: { question: 'The question?', options: [ 'option one', 'option two'] , answer: 'The answer' } 
    , q2: { question: 'The question?', options: [ 'option one', 'option two'] , answer: 'The answer' } 
    , q3: { question: 'The question?', options: [ 'option one', 'option two'] , answer: 'The answer' } 
    , q4: { question: 'The question?', options: [ 'option one', 'option two'] , answer: 'The answer' } 
  } } 
  
var obj = JSON.parse(JSON.stringify(json));
console.log(obj);

for (let i = 0; i < obj.quiz.length; i++) {
  document.body.innerHTML +=
    '<h2>' + obj.quiz[i].question + '</h2>'
  document.body.innerHTML +=
    '<form>' + '<input type="radio" name="options" value="option">' + '<label for="option">' + obj.quiz[i].options + '</label>' + '<br>' + '</form>'
}

about 4 years ago · Juan Pablo Isaza
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!