jquery - How to get values of JSON object to string using javascript -


i have json object. example:

{     "id": 1,     "name": "name",     "surname": "surname",     "number": "111111111" } 

how make string json object using javascript, looks this.

name surname 111111111

you can use for...in statement iterating values of object. in loop add every value string.

var json = {      "id": 1,      "name": "name",      "surname": "surname",      "number": "111111111"  };    var str = "";  (var key in json) {      str += (key != "id") ? (json[key] + " ") : "";  }  console.log(str);


Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -