js parse string code example
Example 1: javascript explode
//split into array of strings.
var str = "Well, how, are , we , doing, today";
var res = str.split(",");
Example 2: javascript parse json
var jsonPerson = '{"first_name":"billy", "age":23}';
var personObject = JSON.parse(jsonPerson); //parse json string into JS object
Example 3: javascript parse to string
var bar = foo.toString();
Example 4: js string to object
JSON.parse()
Example 5: string to int javascript
var text = '42px';
var integer = parseInt(text, 10);
// returns 42
Example 6: js string to json
var obj = JSON.parse("{no:'u',my:'sql'}");//returnes {no:'u',my:'sql'}