ws-dottie
Version:
Your friendly TypeScript companion for Washington State transportation APIs - WSDOT and WSF data with smart caching and React Query integration
22 lines • 983 B
TypeScript
/**
* @fileoverview Robust JSON Parsing with Fallback Mechanisms
*
* This module provides a robust JSON parsing utility that attempts multiple
* parsing strategies to handle various JSON formats and potential issues
* from WSDOT API responses. It includes fallback mechanisms for standard JSON,
* JSON5-compatible syntax, and severely malformed JSON.
*/
/**
* Robust JSON parsing with fallback mechanisms
*
* This function attempts to parse JSON input using multiple strategies:
* 1. Try standard JSON.parse (fastest for valid JSON)
* 2. Try json5.parse (handles JSON5 syntax like comments, trailing commas)
* 3. Try jsonrepair + JSON.parse (handles malformed JSON with unescaped quotes)
*
* @param input - The JSON string to parse
* @returns The parsed JavaScript value or object
* @throws The original JSON.parse error if all parsing attempts fail
*/
export declare const parseJsonWithFallback: (input: string) => unknown;
//# sourceMappingURL=jsonParser.d.ts.map