Angular 2 - Create a nested JSON object
<p>I am working on an Angular 2 project that requires me to create a user with address details as shown below</p>

<pre><code>{ "address": {
"addition": null,
"city": "Eindhoven",
"housenumber": 12,
"street": "Streetname"},
"email": "a@b.com",
"password": "",
"username": "YourName"}
</code></pre>

<p>When I GET a user object, the example above is the result. To POST a user object to the back end, I need to create JSON with the same structure.</p>

<p>I am able to display the details of this JSON file when I recieve it. I created two classes:</p>

<pre><code>import {Address} from "./Address";
/**
 * Created by Adjoa on 6/14/2016.
 */
export class User {
    name:string;
    username:string;
    email:string;
    address:Address;



    constructor(name:string, username:string, email:string, address:Address) {
        this.name = name;
        this.username = username;
        this.email = email;
        this.address = address;
    }

    public static createEmptyUser():User{
        return new User("","","",null);
    }
}
</code></pre>

<p>I need help creating a user that has an address before I send it to the API.</p>