Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7b59f88 commit 9f0b20dCopy full SHA for 9f0b20d
README.md
@@ -490,5 +490,21 @@ span.addEventListener("click", function() {
490
});
491
492
```
493
+# Check if a string is a valid JSON
494
+
495
+```javascript
496
+function isJson(str) {
497
+ try {
498
+ JSON.parse(str);
499
+ } catch (e) {
500
+ //the json is not ok
501
+ return false;
502
+ }
503
+ //the json is ok
504
+ return true;
505
+}
506
+```
507
508
509
510
0 commit comments