I want to get specific data from json array


#1

i want to get specific data from json array. and i’m try like this.
alert(JSON.stringify(this.mydata.paymentDate));

i’m right?

here mydata is my json array.


#2

can u explain your question in details so we may know what you exactly want ?


#3

i want to a specific json value from a json array.am attach the json screen shoot and also mark the value.i want to payment date only .how can i do that?


#4

then you can access those value by => this.mydata["MyRoom"].paymentDate


#5

when i used the code that you gave to me .this time showing an error like this.
error123


#6

show me how you write the code ?
there is square bracket used in object


#7
ionViewDidLoad() {
        this.storage.get('user_id').then((value) => {
        this.user_id=value;
        this.http.get("http://www.xxxx.com/demo/append/index.php/myRoom/"+this.user_id)
        .subscribe((res:Response)=>{
        let dataTemp = res.json();
        this.mydata = dataTemp.MyRoom;

        alert(this.mydata["MyRoom"].paymentDate)
       
    }) 
  }); 
}

#8

 this.mydata = dataTemp;

        alert(this.mydata["MyRoom"].paymentDate)

write this way