@loopback/docs
Version:
Documentation files rendered at [https://loopback.io](https://loopback.io)
35 lines (22 loc) • 1.03 kB
Markdown
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/strongloop/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) > [@loopback/testlab](./testlab.md) > [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
<b>Signature:</b>
```typescript
export declare function toJSON(value: object): object;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| value | object | |
<b>Returns:</b>
object