Converting eval parse to json.parse

This pertains within a BPM application called ProcessMaker but the logic and syntax should relatively be the same. I'm trying to populate a grid (basically a table) from another serialized grid where the data has been passed to a hidden field.

The data passed to the hidden field is formatted as follows:



The javascript example below found on processmaker's wiki unserializes the hidden field as an object and uses its information to populate a new grid named whatever it is. The example on processmaker's wiki uses the eval function but how would you convert this using the json.parse() function?

        function populateGrid() {
           var grd = getObject("newAccountsGrid");
           //remove all existing rows in the grid (except the first one): 
           var i = Number_Rows_Grid("newAccountsGrid", "accId");
           for (; i > 1; i--)
              grd.deleteGridRow(i, true);
           //The first row can't be deleted, so clear the fields in the first row:
           for (i = 0; i < grd.aFields.length; i++)
              getGridField("contactsGrid", 1, grd.aFields[i].sFieldName).value = "";
           //unserialize the hidden field as an object:
           var oAccounts = eval('(' + getField("sAccounts").value + ')'); 
           if (typeof oAccounts == 'object') { 
              for (var rowNo in oAccounts) {
                 if (rowNo != 1)
                 getGridField('newAccountsGrid', rowNo, 'accId').href = oAccounts[rowNo]["accountId"];
                 getGridField('newAccountsGrid', rowNo, 'accName').href = oAccounts[rowNo]["accountName"];
                 getGridField('newAccountsGrid', rowNo, 'createDate').href = oAccounts[rowNo]["created"];
        populateGrid(); //execute when the DynaForm loads


It would be as simple as:

var oAccounts = JSON.parse(getField("sAccounts").value);

Need Your Help

TeamCity behind nginx proxy

proxy nginx rewrite teamcity

I am trying to set up TeamCity behind nginx. I'd like to redirect to, but even though nginx does this successfully, the login page ...

The X and Y coordinates of the right callout button are not placing my views accurately

iphone objective-c mkmapview

As you can see below I am using the calloutaccessorycontrol's coordinates to place another view on my mapview. However. it never seems to place the control anywhere near the calloutaccessorycontrol...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.