import { ZNullable, ZOptional } from '../optional/optional.mjs'; /** * Attempts to parse the string buffer as json. * * This is similar to JSON.parse, but instead of throwing * an error, it returns null. * * @param buffer * The string buffer that may be json. * * @returns * The parsed value of the buffer when parsed as JSON. If * buffer is null, undefined, or does not represent valid * JSON, then null is returned. */ export declare function tryJsonParse(buffer: ZOptional): ZNullable; /** * Attempts to parse the string buffer as json. * * This is similar to JSON.parse, but instead of throwing * an error, it returns a fallback value. * * @param buffer - * The string buffer that may be json. * @param fallback - * The fallback value in the case that buffer * cannot be parsed. Note that parsing the text * "null" will return null instead of the fallback. * * @returns * The parsed value of the buffer when parsed as JSON. If * buffer is null, undefined, or does not represent valid * JSON, then fallback is returned. */ export declare function tryJsonParse(buffer: ZOptional, fallback: T): T;