@jenova-marie/wonder-logger - v2.0.15
    Preparing search index...

    Function parseJSONResponse

    • Parse JSON with robust error handling Attempts to extract JSON from text if direct parsing fails

      Type Parameters

      • T = any

      Parameters

      • text: string

        The text to parse (may contain JSON within other content)

      Returns JSONResult<T>

      Result containing parsed object, or error

      const result = parseJSONResponse<Config>('{"name": "test"}')
      if (result.ok) {
      console.log(result.value.name) // "test"
      } else {
      console.error(result.error.message)
      }