JSON.stringifySafe()

Encode the specified value into a JSON string, but tolerate recursive objects and preserve functions, errors, and regexps.

Usage

Hover over inputs/exits for more info.

var JSON = require('machinepack-json');


// Encode the specified value into a JSON string, but tolerate recursive objects and preserve functions, errors, and regexps.

JSON.stringifySafe({

value: '*',

}).execSync();

Inputs

value required

The data to encode as a JSON string

'*'

Exits

error

An unexpected error occurred.

success

OK.

'...{"some stringified json": "like this"}...'