Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 229268

Add data to nested JSON object file

$
0
0

hi guys, i am trying to append some data to a nested JSON file but somehow it’s not getting there
Here is my JSON file
export class createusers{
mail: string
pass: string
field_title: {
und: string
}
field_firstname: {
und:[
{
value: string
}
]
}
field_lastname: {
und:[
{
value: string
}
]
}
field_date_of_birth: {
und:[
{
value: {
date: string
}
}
]
}
field_zip_code: {
und:[
{
value: string
}
]
}
// tid: string
field_city: {
und: string
}
field_phone_home: {
und:[
{
value: string
}
]
}
field_mobile: {
und:[
{
value: string
}
]
}
field_mac_add: {
und:[
{
value: string
}
]
}

}

and this is how i am trying to append the data in it

    this.createusers.mail=credentials.email;
    this.createusers.pass = credentials.password;
    this.createusers.field_title.und= credentials.title;
    this.createusers.field_firstname.und[0].value= credentials.firstname;
    this.createusers.field_lastname.und[0].value = credentials.lastname;
    this.createusers.field_date_of_birth.und[0].value.date = credentials.dob;
    this.createusers.field_zip_code.und[0].value = credentials.zip_code;
    this.createusers.field_city.und = credentials.tid;
    this.createusers.field_phone_home.und[0].value = credentials.home_number;
    this.createusers.field_mobile.und[0].value = credentials.mobile_number;
    this.createusers.field_mac_add.und[0].value = credentials.mac_add;

can anyone help me on that


Viewing all articles
Browse latest Browse all 229268

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>