Skip to content

Structured Output (Beta)



Structured Output is deprecated on the llamaParse API, use the LlamaExtract API instead.



Structured output allows you to extract structured data (such as JSON) from a document directly at the parsing stage, reducing cost and time needed.

Structured output is currently only compatible with our default parsing mode and can be activated by setting structured_output=True in the API.

parser = LlamaParse(
structured_output=True
)


You then need to provide either:

  • a JSON schema in the structured_output_json_schema API variable, which will be used to extract data in the desired format
  • or the name of one of our pre-defined schemas in the variable structured_output_json_schema_name
parser = LlamaParse(
structured_output_json_schema='A JSON SCHEMA'
)




Wildcard schema that lets LlamaParse infer output format

Terminal window
curl -X 'POST' \
'https://api.cloud.llamaindex.ai/api/v1/parsing/upload' \
-H 'accept: application/json' \
-H 'Content-Type: multipart/form-data' \
-H "Authorization: Bearer $LLAMA_CLOUD_API_KEY" \
--form 'structured_output_json_schema_name="imFeelingLucky"' \
-F 'file=@/path/to/your/file.pdf;type=application/pdf'


Standard invoice schema for line items, tax, and totals

Terminal window
curl -X 'POST' \
'https://api.cloud.llamaindex.ai/api/v1/parsing/upload' \
-H 'accept: application/json' \
-H 'Content-Type: multipart/form-data' \
-H "Authorization: Bearer $LLAMA_CLOUD_API_KEY" \
--form 'structured_output_json_schema_name="invoice"' \
-F 'file=@/path/to/your/file.pdf;type=application/pdf'


Follows the JSON Resume standard

Terminal window
curl -X 'POST' \
'https://api.cloud.llamaindex.ai/api/v1/parsing/upload' \
-H 'accept: application/json' \
-H 'Content-Type: multipart/form-data' \
-H "Authorization: Bearer $LLAMA_CLOUD_API_KEY" \
--form 'structured_output_json_schema_name="resume"' \
-F 'file=@/path/to/your/file.pdf;type=application/pdf'