String String, JSON Huzhuan

ARR = the let [l, 2,3]; 
the JSON.stringify (ARR); // '[l, 2,3]' 
arr.toString (); // l, 2,3 


the let ARR = [1,2, . 3]; the JSON.stringify (ARR); // '[l, 2,3]' typeof the JSON.stringify (ARR); // String
using the JSON.parse () to note that, since this method is a character JSON converted into a string object, so you must comply with JSON format string, i.e., the key must be used in double quotes wrapping : the let string = '[l, 2,3]'; the console.log (the JSON.parse (string)) / / [l, 2,3] the console.log (typeof the JSON.parse (String)) // Object

Guess you like

Origin www.cnblogs.com/lingya/p/12457270.html