• Converts a JSON string into a value, converting all null properties from JSON into undefined in the returned JavaScript value/object.

    WARNING: null values will become undefined values after passing through serialize then deserialize. For example, { a: 1, b: undefined, c: null } will become { a: 1, b: undefined, c: undefined }. If you are passing around user data that needs to retain null values, you should wrap them yourself in a string before using this function. Alternatively, you can write your own replacer that will preserve null in a way that you can recover later.

    Parameters

    • value: string

      A valid JSON string.

    • Optionalreviver: (this: unknown, key: string, value: unknown) => unknown

      A function that transforms the results. This function is called for each member of the object. If a member contains nested objects, the nested objects are transformed before the parent object is. Note that null values are converted into undefined values after the reviver has run.

    Returns any