# Class ConverterService

Class deprecated private
Module
import { ConverterService } from "@tsed/platform/common/src/services/ConverterService"
Source/packages/platform/common/src/services/ConverterService.ts

# Overview

class ConverterService {
    #private;
<span class="token keyword">constructor</span><span class="token punctuation">(</span>injectorService<span class="token punctuation">:</span> <a href="/api/di/services/InjectorService.html"><span class="token">InjectorService</span></a><span class="token punctuation">,</span> configuration<span class="token punctuation">:</span> <a href="/api/di/decorators/Configuration.html"><span class="token">Configuration</span></a><span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token function">serialize</span><span class="token punctuation">(</span>obj<span class="token punctuation">:</span> <span class="token keyword">any</span><span class="token punctuation">,</span> options?<span class="token punctuation">:</span> <a href="/api/specs/json-mapper/utils/JsonSerializerOptions.html"><span class="token">JsonSerializerOptions</span></a><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token keyword">any</span><span class="token punctuation">;</span>

<span class="token function">deserialize</span><span class="token punctuation">(</span>obj<span class="token punctuation">:</span> <span class="token keyword">any</span><span class="token punctuation">,</span> options?<span class="token punctuation">:</span> <a href="/api/specs/json-mapper/utils/JsonDeserializerOptions.html"><span class="token">JsonDeserializerOptions</span></a><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token keyword">any</span><span class="token punctuation">;</span>

}

# Members

#private;

serialize(obj: any, options?: JsonSerializerOptions): any;

Convert instance to plainObject.


deserialize(obj: any, options?: JsonDeserializerOptions): any;
Param Type Description
obj any Object source that will be deserialized options

Convert a plainObject to targetType.

# Options

  • ignoreCallback: callback called for each object which will be deserialized. The callback can return a boolean to avoid the default converter behavior.
  • checkRequiredValue: Disable the required check condition.

Other topics