/** * JSON Extraction Utilities * * Utilities for extracting JSON from text that may be wrapped in markdown * code blocks or contain other surrounding content. Useful for parsing * LLM responses that include JSON. * * @since 0.18.0 */ /** * Extract JSON string from text that may be wrapped in markdown code blocks. * * Handles: * - ```json ... ``` * - ``` ... ``` * - Raw JSON objects { ... } * - Raw JSON arrays [ ... ] * * @param text - The text containing JSON * @returns The extracted JSON string, or null if no JSON found */ declare function extractJsonString(text: string): string | null; /** * Extract and parse JSON from text that may be wrapped in markdown code blocks. * * @param text - The text containing JSON * @returns The parsed JSON object, or null if extraction or parsing failed */ declare function extractJson(text: string): T | null; /** * Extract and parse JSON from text, with a fallback value if extraction fails. * * @param text - The text containing JSON * @param fallback - Value to return if extraction or parsing fails * @returns The parsed JSON object or the fallback value */ declare function extractJsonOrDefault(text: string, fallback: T): T; export { extractJson, extractJsonOrDefault, extractJsonString };