Minimized JS is_json() function


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function is_json(a) {
  2. if (!a || a.toString() === "") return !1;
  3. try {
  4. return $.parseJSON(a.toString())
  5. } catch (b) {
  6. return !1
  7. }
  8. }
  9.  
  10. // Requires jQuery Library to parse json string.

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.