Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

simple Strings, not json style

ANSWERED

Hi

I'm trying to get a simple app going, howerver im new to json, im trying to read a simple barometer reading, but  i cant figure out i can return a simple string/int  value.

 

barData.text = JSON.stringify(data.bar) + " mb";

im getting {"pressure":1005} mb, 

 

Is there something like Unstringify, without the pressure label.

 

thx,

 

Chris

 

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

This object have the member pressure. You can just write 

 

barData.text = parseInt(bar.pressure) + " mb";

 

(parseInt removes number after the decimal Point)

View best answer in original post

Best Answer
0 Votes
2 REPLIES 2

This object have the member pressure. You can just write 

 

barData.text = parseInt(bar.pressure) + " mb";

 

(parseInt removes number after the decimal Point)

Best Answer
0 Votes

Thanks Hquick60,

 

That works, 

Best Answer
0 Votes