Node Promiscuous Modules

    safely-parse-json

    0.1.0 • Public • Published

    Parse JSON safely

    const safe = require('safely-parse-json');
     
    const value = '{ "one": "one" }';
    const result = safe(value, options); // value parsed

    Options are,

    • checkString: if true will assume error if value is not string [default: true]
    • returnError: if true will also return error, and result will be of from { value, error } [default: false]
    • nullOnError: if true will not return the original value on error, will return null instead [default: false]

    Keywords

    Install

    npm i safely-parse-json

    DownloadsWeekly Downloads

    309

    Version

    0.1.0

    License

    ISC

    Unpacked Size

    12.4 kB

    Total Files

    5

    Last publish

    Collaborators

    • akshendra