Harikag
December 19, 2019, 7:37am
1
Hi I have get request like below
this.http.get(url,{}).subscribe(data=>{
console.log(data);
this.jsonData=JSON.stringify(data);
console.log("data is " + this.jsonData.responce);
var result = this.jsonData.responce;
});
am able to get data like below
{tetra_PORT: “8081”, Email: “xxxx@yyy.com ”, server_PORT: “8888”, response: “success”, tetra_IP: “221.222.22.222”, …}
Email: “ssss@aaaa.com ”
response: “success”
server_IP: “111.111.11.111”
server_PORT: “8888”
tetra_IP: “111.111.11.111”
tetra_PORT: “8888”
users: (357) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…},
am unable to read data.
How to read data please guide me.
Can you please explain your issue as how you want to display the data or your are getting any error.
Harikag
December 19, 2019, 10:01am
3
am not getting any error. It is printing data in console but am unable to read data.
beow is my response
{
“tetra_PORT”: “8888”,
“Email”: “sssss@sssss.com ”,
“server_PORT”: “8888”,
“response”: “success”,
“tetra_IP”: “111.111.11.111”,
“server_IP”: “111.111.11.111”,
“users”: [
{
“name”: “AAAAAA BBBBB”,
“checked”: false,
“email”: null
},
{
“name”: “CCCCC DDDDD”,
“checked”: false,
“email”: null
}]
}
So I want to read this data. It is not allowing to read as per my above code.
Please describe what to you mean with “read” the data. When your app prints out the response to the console, where is the problem?
1 Like
Harikag
December 19, 2019, 10:24am
5
Hi,Ok in my question, Check the line for
var result=this.jsonData.responce;
it is giving undefined, I want to access responce value, based on that responce I want to do further operations . etc.
what happens when you try to log out the parsed JSON jsonData
?
this.http.get(url,{}).subscribe(data=>{
console.log(data);
this.jsonData=data;
console.log("data is " + this.jsonData.responce);
var result = this.jsonData.responce;
});
No you are trying to log out jsonData.responce
, but in your actual response i see only an field response
. So you might have a typo here? responce
instead of response
?
if you get direct JSON data from the server then why we have to stringify JSON again in response
you don’t have to parse it
Try to commpent out all in the then() Block and only log out:
console.log(data.response);
Harikag
December 19, 2019, 10:34am
13
Yes, It is working. Thanks both of you. I did stupid mistake.
Harikag
December 19, 2019, 10:34am
14
Thank you soo much. It is working now.
Harikag
December 19, 2019, 10:45am
15
Can you guide me implementing for emoji’s keyboard for a chat application?
I am implementing emoji’s,
I installed emoji’s plugin too.
Below link shows that
Key board is showing like this
[emoji]
So please help me.
Below is My code
<div class="message_row" style="width:300px;">
<button ion-button clear icon-only (click)="toggled = !toggled" [(emojiPickerIf)]="toggled" [emojiPickerDirection]="'bottom'"
(emojiPickerSelect)="handleSelection($event)" style="position: absolute;
z-index: 9;
left: 0px;…
Please check this Query