var validator = require('validator'); var date = '[{"code":0,"date":"70303316416"}1231]'; if (!validator.isJSON(date)){ console.log('JSON格式异常!') } else { console.log('JSON格式正常!') }
Node.js判断 json格式
最新推荐文章于 2024-05-15 15:18:24 发布
var validator = require('validator'); var date = '[{"code":0,"date":"70303316416"}1231]'; if (!validator.isJSON(date)){ console.log('JSON格式异常!') } else { console.log('JSON格式正常!') }