Use JSON.parse
function isJson(str) {
try {
JSON.parse(str);
} catch (e) {
return false;
}
return true;
}
More Related Contents:
- Can JavaScript connect with MySQL?
- Convert JSON to array in Javascript
- How to use JSON from instagram API?
- Access denied for user ‘admin’@’localhost’ (using password: YES) sql exception
- How do I iterate over a JSON structure? [duplicate]
- Traverse all the Nodes of a JSON Object Tree with JavaScript
- Is it not possible to stringify an Error using JSON.stringify?
- JSON datetime between Python and JavaScript
- variable scope in d3 javascript
- Uncaught SyntaxError: Unexpected token with JSON.parse
- Parsing JSON giving “unexpected token o” error [duplicate]
- How to get object length [duplicate]
- How to filter JSON Data in JavaScript or jQuery?
- How to stringify inherited objects to JSON?
- JSON.stringify deep objects
- sending file and json in POST multipart/form-data request with axios
- JSON object undefined in Internet Explorer 8
- Reverse of JSON.stringify?
- Jquery getJSON populate select menu question
- Encrypt string in PHP and decrypt in Node.js
- how to change the headers for angularjs $http.jsonp
- search data from html input in mysql
- How to solve Uncaught RangeError when download large size json
- Make XmlHttpRequest POST using JSON [duplicate]
- JSON Parse File Path
- Remove key-value pair from JSON object
- How to restore original object/type from JSON?
- Cross-Origin resource sharing and file://
- sending data as JSON object from Python to Javascript with Jinja [duplicate]
- Process a continuous stream of JSON