Object serialization in short, the object is converted to a string. In the process of data transmission, object serialization is often used.
Serialization of objects commonly used in javascript: Json.stringify ();
Deserialization of objects commonly used in javascript: Json.parse ();
Note: json.stringify compatible IE8+,IE7 as well as the available json2.js, the corresponding resources can be downloaded online
var a = {"name": "Mary", "Age": "100"}
var B = json.stringify (a); The resulting data ' {' name ': ' Mary ', ' age ': ' + ' to turn data into a string
var C = json.parse (b); The resulting data {"name": "Mary", "Age": "100"} will restore the data to its original object form
JS to encode the text involves 3 functions: Escape,encodeuri,encodeuricomponent, the corresponding 3 decoding function: unescape,decodeuri,decodeuricomponent
Escape escapes the string, which is generally not commonly used, and it escapes escape () to encode all incoming strings except ASCII letters, numbers, and specific symbols.
encodeURI encodes a string as a URI, which is generally used to encode the entire URI, because the legitimate characters in the URI are not encoded for conversion.
encodeURIComponent encodes the string as a URI component. The encoded data default parameter is part of a URI (such as a protocol, host name, path, or query string). Instead, encodeURI encodes the entire URI.
JavaScript data-related processing, serialization deserialization, data encoding and decoding