Validate or check a json string in Javascript
You can use this json validator Javascript component to validate a json string, returning the exception if not (see tests).
Example:
const vaildateJson = require('bit/global/json-validator');
vaildateJson(jsonStr).catch(err => console.log(err))
Test Summary
validate json string validate proper json str - Pass
validate json string when sending number should get exception - Pass
validate json string when sending broken json should get exception - Pass
Written by Codi
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Javascript
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#