title: How to structure the output of a form in Angular to conform to REST input
body: <p>Thank you in advance for your help. </p>
  
  <p>I have a form in Angular that produces output: </p>
  
  <pre><code>{user: "3", comment: "comment"}
  comment: "comment"
  user: "3"
  </code></pre>
  
  <p>For my REST input, I am looking for: </p>
  
  <pre><code>{
   "user": {
    "id": 2
  }, 
    "comment": "this is a comment"
  }
  </code></pre>
  
  <p>I am running in circles between updating the method on the controller side vs adjust the form output. </p>
  
  <p>Here is what I have on the form side: </p>
  
  <pre><code>&lt;div *ngIf='clientDetail'&gt;
  
        &lt;strong&gt;NAME:&lt;/strong&gt; {{gotClient.firstName}} {{gotClient.lastName}} &lt;BR&gt;
        &lt;strong&gt;EMAIL:&lt;/strong&gt;{{gotClient.email}}&lt;BR&gt;
        &lt;strong&gt;PHONE:&lt;/strong&gt;{{gotClient.phone}}&lt;BR&gt;
        &lt;strong&gt;AGENT:&lt;/strong&gt;{{gotClient.agent}}&lt;BR&gt;
          &lt;HR&gt;
            &lt;form #h="ngForm" (ngSubmit)="onSubmitComment(h)" novalidate&gt;
            CLIENT: &lt;input type="text" name="user" ngModel="{{gotClient.id}}"&gt;&lt;BR&gt;
            INPUT: &lt;input type="text" name="comment" ngModel="comment"&gt;&lt;BR&gt;
            &lt;!-- &lt;button (click)='addComment(comment)'&gt;Add Comment&lt;/button&gt; --&gt;
            &lt;button&gt;Submit&lt;/button&gt;
            &lt;/form&gt;
            &lt;P&gt;&lt;/P&gt;
  
        &lt;strong&gt;COMMENTS:&lt;/strong&gt;&lt;BR&gt;
            &lt;ul *ngFor="let item of gotClient.comments"&gt;
                &lt;li&gt;{{item.comment}}&lt;/li&gt;
            &lt;/ul&gt;
    &lt;/div&gt;
  </code></pre>
  
  <p>My specific question (I think) is how do I modify the form output? </p>
  
  <p>Edit: </p>
  
  <pre><code>onSubmitComment(h: NgForm) {
  
  console.log('H VALUE: ' + h.value)
    console.log('this is the comment: ' + h.value.comment);
    console.log('this is the id: ' + h.value.id);
  
    this.crmRest.createComment(h.value).subscribe(
      data =&gt; {
        this.ngOnInit();
      },
      err =&gt; console.error('Observer got an error: ' + err)
      );
  
    h.resetForm();
  } 
  </code></pre>