Function validateParse

  • You must configure the generic argument T.

    Safe JSON.parse() function with detailed type validation.

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

    In such reason, when parsed JSON string value is not matched with the type T, it returns IValidation.IFailure value with detailed error reasons. Otherwise, there's no problem on the parsed value, the parsed value would be stored in data property of the output IValidation.ISuccess instance.

    Parameters

    • input: string

      JSON string

    Returns never

    Validation result with JSON parsed value

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

  • Safe JSON.parse() function with detailed type validation.

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

    In such reason, when parsed JSON string value is not matched with the type T, it returns IValidation.IFailure value with detailed error reasons. Otherwise, there's no problem on the parsed value, the parsed value would be stored in data property of the output IValidation.ISuccess instance.

    Type Parameters

    • T

      Expected type of parsed value

    Parameters

    • input: string

      JSON string

    Returns IValidation<Primitive<T>>

    Validation result with JSON parsed value

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