parse_json_markdown() — langchain Function Reference
Architecture documentation for the parse_json_markdown() function in json.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 0674c31d_4e25_0239_78af_91c5993e3cb3["parse_json_markdown()"] 20a5fe84_8249_f1df_53f0_7f22870f123f["json.py"] 0674c31d_4e25_0239_78af_91c5993e3cb3 -->|defined in| 20a5fe84_8249_f1df_53f0_7f22870f123f 0674c31d_4e25_0239_78af_91c5993e3cb3["parse_json_markdown()"] 0674c31d_4e25_0239_78af_91c5993e3cb3 -->|calls| 0674c31d_4e25_0239_78af_91c5993e3cb3 2f7cfdad_4633_8189_c0c2_fc7e4941b8a9["parse_and_check_json_markdown()"] 2f7cfdad_4633_8189_c0c2_fc7e4941b8a9 -->|calls| 0674c31d_4e25_0239_78af_91c5993e3cb3 0674c31d_4e25_0239_78af_91c5993e3cb3["parse_json_markdown()"] 0674c31d_4e25_0239_78af_91c5993e3cb3 -->|calls| 0674c31d_4e25_0239_78af_91c5993e3cb3 9e969ef0_5395_65ea_99a0_e06563a3e201["_parse_json()"] 0674c31d_4e25_0239_78af_91c5993e3cb3 -->|calls| 9e969ef0_5395_65ea_99a0_e06563a3e201 style 0674c31d_4e25_0239_78af_91c5993e3cb3 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/utils/json.py lines 142–163
def parse_json_markdown(
json_string: str, *, parser: Callable[[str], Any] = parse_partial_json
) -> Any:
"""Parse a JSON string from a Markdown string.
Args:
json_string: The Markdown string.
parser: The parser to use.
Returns:
The parsed JSON object as a Python dictionary.
"""
try:
return _parse_json(json_string, parser=parser)
except json.JSONDecodeError:
# Try to find JSON string within triple backticks
match = _json_markdown_re.search(json_string)
# If no match found, assume the entire string is a JSON string
# Else, use the content within the backticks
json_str = json_string if match is None else match.group(2)
return _parse_json(json_str, parser=parser)
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does parse_json_markdown() do?
parse_json_markdown() is a function in the langchain codebase, defined in libs/core/langchain_core/utils/json.py.
Where is parse_json_markdown() defined?
parse_json_markdown() is defined in libs/core/langchain_core/utils/json.py at line 142.
What does parse_json_markdown() call?
parse_json_markdown() calls 2 function(s): _parse_json, parse_json_markdown.
What calls parse_json_markdown()?
parse_json_markdown() is called by 2 function(s): parse_and_check_json_markdown, parse_json_markdown.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free