# ConverterService Service

Module
import { ConverterService } from "@tsed/common"
Source/packages/common/src/converters/services/ConverterService.ts

# Overview

class ConverterService {
<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>
/**
 * Return a JsonMetadata for a properties.
 * @param properties
 * @param propertyKey
 * @returns <span class="token punctuation">{</span>undefined|V|<span class="token keyword">string</span>|<span class="token keyword">any</span>|T|IDBRequest<span class="token punctuation">}</span>
 */
<span class="token keyword">static</span> <span class="token function">getPropertyMetadata</span><span class="token punctuation">(</span>properties<span class="token punctuation">:</span> Map&lt;<span class="token keyword">string</span> | symbol<span class="token punctuation">,</span> <a href="/api/common/mvc/models/PropertyMetadata.html"><span class="token">PropertyMetadata</span></a>&gt;<span class="token punctuation">,</span> propertyKey<span class="token punctuation">:</span> <span class="token keyword">string</span> | symbol<span class="token punctuation">)</span><span class="token punctuation">:</span> <a href="/api/common/mvc/models/PropertyMetadata.html"><span class="token">PropertyMetadata</span></a> | undefined<span class="token punctuation">;</span>
/**
 * Convert instance to plainObject.
 *
 * ### <a href="/api/common/mvc/decorators/method/Options.html"><span class="token">Options</span></a>
 *
 * - `checkRequiredValue`<span class="token punctuation">:</span> Disable the required check condition.
 *
 * @param obj
 * @param options
 */
<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/common/converters/interfaces/IConverterOptions.html"><span class="token">IConverterOptions</span></a><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token keyword">any</span><span class="token punctuation">;</span>
/**
 *
 * @param obj
 * @param <span class="token punctuation">{</span><a href="/api/common/converters/interfaces/IConverterOptions.html"><span class="token">IConverterOptions</span></a><span class="token punctuation">}</span> options
 * @returns <span class="token punctuation">{</span><span class="token keyword">any</span><span class="token punctuation">}</span>
 */
<span class="token function">serializeClass</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/common/converters/interfaces/IConverterOptions.html"><span class="token">IConverterOptions</span></a><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token keyword">any</span><span class="token punctuation">;</span>
/**
 * Convert a plainObject to targetType.
 *
 * ### <a href="/api/common/mvc/decorators/method/Options.html"><span class="token">Options</span></a>
 *
 * - `ignoreCallback`<span class="token punctuation">:</span> callback called for each object which will be deserialized. The callback can return a <span class="token keyword">boolean</span> to avoid the default converter behavior.
 * - `checkRequiredValue`<span class="token punctuation">:</span> Disable the required check condition.
 *
 * @param obj Object source that will be deserialized
 * @param targetType <a href="/api/common/jsonschema/decorators/Pattern.html"><span class="token">Pattern</span></a> of the object deserialized
 * @param baseType
 * @param options
 * @returns <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> targetType<span class="token punctuation">:</span> <span class="token keyword">any</span><span class="token punctuation">,</span> baseType?<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/common/converters/interfaces/IConverterOptions.html"><span class="token">IConverterOptions</span></a><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token keyword">any</span><span class="token punctuation">;</span>
/**
 *
 * @param targetType
 * @returns <span class="token punctuation">{</span><span class="token keyword">any</span><span class="token punctuation">}</span>
 */
getConverter&lt;T <span class="token keyword">extends</span> <a href="/api/common/converters/interfaces/IConverter.html"><span class="token">IConverter</span></a>&gt;<span class="token punctuation">(</span>targetType<span class="token punctuation">:</span> <span class="token keyword">any</span><span class="token punctuation">)</span><span class="token punctuation">:</span> T | undefined<span class="token punctuation">;</span>
/**
 *
 * @param <span class="token punctuation">{</span><a href="/api/core/interfaces/Type.html"><span class="token">Type</span></a>&lt;<span class="token keyword">any</span>&gt;<span class="token punctuation">}</span> target
 * @returns <span class="token punctuation">{</span>"error" | "accept" | "ignore"<span class="token punctuation">}</span>
 */
<span class="token function">getAdditionalPropertiesLevel</span><span class="token punctuation">(</span>target<span class="token punctuation">:</span> <a href="/api/core/interfaces/Type.html"><span class="token">Type</span></a>&lt;<span class="token keyword">any</span>&gt;<span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token string">"error"</span> | "accept" | "ignore" | undefined<span class="token punctuation">;</span>
/**
 *
 * @param obj
 * @param instance
 * @param <span class="token punctuation">{</span><span class="token keyword">string</span><span class="token punctuation">}</span> propertyName
 * @param <span class="token punctuation">{</span><a href="/api/common/mvc/models/PropertyMetadata.html"><span class="token">PropertyMetadata</span></a><span class="token punctuation">}</span> propertyMetadata
 * @param options
 */

/**
 * @deprecated
 * @param instance
 * @param <span class="token punctuation">{</span>Map&lt;<span class="token keyword">string</span> | symbol<span class="token punctuation">,</span> <a href="/api/common/mvc/models/PropertyMetadata.html"><span class="token">PropertyMetadata</span></a>&gt;<span class="token punctuation">}</span> properties
 */

/**
 *
 * @param instance
 * @param <span class="token punctuation">{</span><span class="token keyword">string</span><span class="token punctuation">}</span> propertyKey
 * @param <span class="token punctuation">{</span><a href="/api/common/mvc/models/PropertyMetadata.html"><span class="token">PropertyMetadata</span></a> | undefined<span class="token punctuation">}</span> propertyMetadata
 * @param options
 */

}