@aurelia/fetch-client
Version:
[](https://opensource.org/licenses/MIT) [](http://www.typescriptlang.org/) [ • 429 B
text/typescript
/**
* Serialize an object to a JSON string. Useful for easily creating JSON fetch request bodies.
*
* @param body - The object to be serialized to JSON.
* @param replacer - The JSON.stringify replacer used when serializing.
* @returns A JSON string.
*/
export function json(body: unknown, replacer?: (key: string, value: unknown) => unknown): string {
return JSON.stringify((body !== undefined ? body : {}), replacer);
}