number2json

Return a JSON representation of a number.

Usage

var number2json = require( '@stdlib/number/float64/to-json' );

number2json( x )

Returns a JSON representation of a number.

var json = number2json( NaN );
/* returns
    {
        'type': 'float64',
        'value': 'NaN'
    }
*/

Examples

var number2json = require( '@stdlib/number/float64/to-json' );

console.log( number2json( NaN ) );
Did you find this page helpful?