Page Contents

Home > @loopback/testlab > toJSON

toJSON() function

JSON encoding does not preserve properties that are undefined As a result, deepEqual checks fail because the expected model value contains these undefined property values, while the actual result returned by REST API does not. Use this function to convert a model instance into a data object as returned by REST API

Signature:

export declare function toJSON(value: object): object;

Parameters

Parameter Type Description
value object  

Returns:

object