The Zurich release has arrived! Interested in new features and functionalities? Click here for more

How to Split a Value that is in a Multi line Text field into new lines

ursnani
Giga Guru

Hi,

I am fetching a value through a webservice ('parametes') which is "{"FirstName":"Rob","LastName":"Civitello","ID":"XXXXXX","Location":"XXXXXX"}". I want to split this value and display it in Mutli Line text field as follows

FirstName:Rob

LastName:Civitello

ID:XXXXXXX
Location:XXXXXXXXX.

Can some Please help me in spliting these and dispalying as mentioned.

Thanks,

6 REPLIES 6

It is simple. Try this.



var obj = JSON.parse('{"FirstName":"Rob", "LastName":"Civitello", "ID":"XXXXXX", "Location":"XXXXXX"}');



for (k in obj) {


gs.print(k + ':'+obj[k]);


}



Please mark this response as correct or helpful if it assisted you with your question.

Sanjiv has already provided the solution, for more info, please refer: JSON Objects