File

src/app/shared/support/object.utils.ts

Description

Contains common Object/JSON related helper methods.

Example

Index

Methods

Methods

Public convertJsonToMap
convertJsonToMap(json: any)

Convert a JSON object notation to a Map.

Parameters :
Name Type Optional Description
json any
Returns : Map<stringstring>
export class ObjectUtils {

  /**
   * Convert a JSON object notation to a Map.
   */
  public static convertJsonToMap(json: any): Map<string, string> {
    if (!json) {
      return undefined;
    }
    const map = new Map<string, string>();
    Object.keys(json).forEach(key => {
      map.set(key, json[key]);
    });
    return map;
  }
}

results matching ""

    No results matching ""