UNPKG

@loopback/docs

Version:

Documentation files rendered at [https://loopback.io](https://loopback.io)

63 lines (33 loc) 1.2 kB
--- lang: en title: 'API docs: testlab.tojson_3' keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI sidebar: lb4_sidebar editurl: https://github.com/loopbackio/loopback-next/tree/master/packages/testlab permalink: /doc/en/lb4/apidocs.testlab.tojson_3.html --- <!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [@loopback/testlab](./testlab.md) &gt; [toJSON](./testlab.tojson_3.md) ## 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:** ```typescript export declare function toJSON(value: object): object; ``` ## Parameters <table><thead><tr><th> Parameter </th><th> Type </th><th> Description </th></tr></thead> <tbody><tr><td markdown="1"> value </td><td markdown="1"> object </td><td markdown="1"> </td></tr> </tbody></table> **Returns:** object