contextToJson
utils
Source Code | DocumentationConverts a FeathersJS HookContext to a plain JSON object by calling toJSON() if available. This is important when using lodash get/has on the context, since the HookContext class uses getters that may not be enumerable.
ts
import { contextToJson } from 'feathers-utils/utils';Example
ts
import { contextToJson } from 'feathers-utils/utils'
const json = contextToJson(context)
console.log(json)Type declaration
Show Type Declarations
ts
/**
* Converts a FeathersJS HookContext to a plain JSON object by calling `toJSON()` if available.
* This is
*
* const json = contextToJson(context)
* console.log(json)
* ```
*
* @see https://utils.feathersjs.com/utils/context-to-json.html
*/
export declare const contextToJson: (context: HookContext) => any| Argument | Type | Description |
|---|---|---|
| context | HookContext |
