Q:

How to Send data of dynamic fields created from a database in JSON format in angular 6

I have a form that has fixed fields as well as dynamic fields created from a database. the fields could be different every time.So how do i access a dynamic generated formControl value in in JSON format like this category object .
Output is :- 
Category:[
  {
    "label": "test1",
    "measurements": {
        length:10,
        Shoulder:20,
        Chest: 20
    }
  },
  {
    "label": "test2",
    "measurements": {
        stomach:10,
        thigh:20 }
  }
]

<div *ngFor="let item of clickCategoryData let pointIndex=index">
<p><b>{{item.label}}</b></p>
<div *ngFor="let measurement of item.measurements;">
<label>{{measurement.name}}</label>
<input type="number" class="box" [placeholder]="measurement.name" [id]="measurement.id"  required>
</div>
</div>

A:

convert your existing array to output array which you want as this 
this.clickCategoryData.forEach(
      data => {
        let jsonObj = {}
        data.measurements.forEach(mes => jsonObj[mes.name] = "")
          data.measurements = jsonObj
      }
    )

here is the stackBlitz Link

