RecursiveJsonSplitter#

class langchain_text_splitters.json.RecursiveJsonSplitter(max_chunk_size: int = 2000, min_chunk_size: int | None = None)[source]#

Methods

__init__([max_chunk_size, min_chunk_size])

create_documents(texts[, convert_lists, ...])

Create documents from a list of json objects (Dict).

split_json(json_data[, convert_lists])

Splits JSON into a list of JSON chunks

split_text(json_data[, convert_lists, ...])

Splits JSON into a list of JSON formatted strings

Parameters:
  • max_chunk_size (int) –

  • min_chunk_size (Optional[int]) –

__init__(max_chunk_size: int = 2000, min_chunk_size: int | None = None)[source]#
Parameters:
  • max_chunk_size (int) –

  • min_chunk_size (int | None) –

create_documents(texts: List[Dict], convert_lists: bool = False, ensure_ascii: bool = True, metadatas: List[dict] | None = None) List[Document][source]#

Create documents from a list of json objects (Dict).

Parameters:
  • texts (List[Dict]) –

  • convert_lists (bool) –

  • ensure_ascii (bool) –

  • metadatas (List[dict] | None) –

Return type:

List[Document]

split_json(json_data: Dict[str, Any], convert_lists: bool = False) List[Dict][source]#

Splits JSON into a list of JSON chunks

Parameters:
  • json_data (Dict[str, Any]) –

  • convert_lists (bool) –

Return type:

List[Dict]

split_text(json_data: Dict[str, Any], convert_lists: bool = False, ensure_ascii: bool = True) List[str][source]#

Splits JSON into a list of JSON formatted strings

Parameters:
  • json_data (Dict[str, Any]) –

  • convert_lists (bool) –

  • ensure_ascii (bool) –

Return type:

List[str]

Examples using RecursiveJsonSplitter