Skip to Content
0
Former Member
Feb 28, 2014 at 12:48 PM

Convert Text String to JSON object

2265 Views

Hi,

How can a string be converted to a JSON object in SAPUI5 ?

Example : var mystr = ' [ { name : "Joe", last : "Doe"}, { name : "Jack", last : "Daniel" }]';

How do i convert mystr to a JSON object which can be used in a JSONModel?

$,parseJSON(mystr) or jQuery.parseJSON(myStr) do not seem to exist.

JSONModel.setJSON(mystr) too did not work.

Any pointers ?

regards,

sreeram