Function isParse

  • You must configure the generic argument T.

    Safe JSON.parse() function with type checking.

    typia.json.isParse() is a combination function of JSON.parse() and is. Therefore, it convers a JSON (JavaScript Object Notation) string to a T typed instance with type checking.

    In such reason, when parsed JSON string value is not matched with the type T, it returns null value. Otherwise, there's no problem on the parsed value, the parsed value would be returned.

    Parameters

    • input: string

      JSON string

    Returns never

    Parsed value when exact type, otherwise null

    Jeongho Nam - https://github.com/samchon

  • Safe JSON.parse() function with type checking.

    typia.json.isParse() is a combination function of JSON.parse() and is. Therefore, it convers a JSON (JavaScript Object Notation) string to a T typed instance with type checking.

    In such reason, when parsed JSON string value is not matched with the type T, it returns null value. Otherwise, there's no problem on the parsed value, the parsed value would be returned.

    Type Parameters

    • T

      Expected type of parsed value

    Parameters

    • input: string

      JSON string

    Returns Primitive<T> | null

    Parsed value when exact type, otherwise null

    Jeongho Nam - https://github.com/samchon