title: How to create JSON Object in JavaScript?
body: <p>I have JSON like this :</p>
  <pre><code>{
     &quot;success&quot;:true,
     &quot;data&quot;:[
        {
           &quot;id&quot;: 1,
           &quot;markname&quot;:&quot;nama_penduduk&quot;,
           &quot;markvalue&quot;:&quot;Vin Diesel&quot;
        },
        {
           &quot;id&quot;: 2,
           &quot;markname&quot;:&quot;umur_penduduk&quot;,
           &quot;markvalue&quot;:&quot;20 Tahun&quot;
        },
        {
           &quot;id&quot;: 3,
           &quot;markname&quot;:&quot;keperluan_membuat_surat&quot;,
           &quot;markvalue&quot;:&quot;Untuk uji coba surat&quot;
        }
     ]
  }
  </code></pre>
  <p>I'm trying to create a JSON like this :</p>
  <pre><code>const newJSON = {
      nama_penduduk: 'Vin Diesel',
      umur_penduduk: '20 Tahun',
      keperluan_membuat_surat: 'Untuk uji coba surat'
  };
  </code></pre>
  <p>Code :</p>
  <pre><code>dataResult.map((value) =&gt; {
    const markName = value.markname;
    const markValue = value.markvalue;
  
    res.status(200).json({
        markName: markValue
    });
  });
  </code></pre>
  <p>Suppose I don't know how many data I have, how do I create this object in JavaScript?</p>