jsUtils.serialize()

Returns serialized representation of a JavaScript object.

jsUtils.serialize( obj )
  obj - JavaScript object

An input object will be converted to a serialized string reperenting this object. The object can be an array or any other JavaScript object and can be nested. The serialized representation is not serialized in PHP or any other format. It is used to convert an object into a string to be transmitted as a GET or POST parameter. You will need to unserialize this object on the server side. The object is serialized in url safe way.

Both jsList and jsEdit use jsUtils.serialize() before they transfer parameters to the server.

Example

<!DOCTYPE html>
<html>
<head>
    <script src="system/libs/jsUtils.js" type="text/javascript"></script>
    <script type="text/javascript">
        var arr = [1, 2, 'string', {}];
        window.onload = function() {
            alert(jsUtils.serialize(arr));
        }
    </script>
<body>
</body>
</html>

See Also