javascript is valid json string
function isValidJSONString(str) {
try {
JSON.parse(str);
} catch (e) {
return false;
}
return true;
}
//usage
var personJSONString = '{"first_name":"Tony","last_name":"Hawk","age":31}';
if(isValidJSONString(personJSONString)){
//cool we are valid, lets parse
var person= JSON.parse(personJSONString);
}
Also in JavaScript:
- angular multiple validator pattern single input
- jquery ajax form submission
- Angular Quick Tip: Binding Specific Keys to the Keyup and Keydown Events
- bootstrap cdn for jquery
- javascript range of integers
- video recorder using webrtc and javascript
- dropdown list value react fragment
- handleClickoutside custom hook react
- core.js:6228 ERROR TypeError: Cannot read property 'image' of undefined
- too many open files react native
- jquery remove string from string
- google script get sheet size
- delete character between index
- google script range get cell values
- user agent chrome
- godot destroy node
- mongodb replace document
- jquery onclick function
- js trim out input white space
- convert date to unix timestamp javascript
- array javascript
- cut text if too long javascript
- increase node heap size
- get gcf javascriot