Error while parsing the file 'filename.pdf': 'json' #256

Closed
opened 2026-02-16 00:17:17 -05:00 by yindo · 8 comments
Owner

Originally created by @johnisanerd on GitHub (Sep 6, 2024).

Originally assigned to: @BinaryBrain on GitHub.

I get the following output when I run this code:

documents = LlamaParse(

        result_type="json",
        split_by_page=False,
        parsing_instruction=extraction_instructions
    ).load_data(pdf_path)  

Gives the error:

Started parsing the file under job_id 6e516bf7-de76-4f0a-85be-da416364a5ca
Error while parsing the file '18f0aecc51523b1b_attachment_2.pdf': 'json'

This returns:
[]

Verbose does not seem to expand the error message.

Changing the result_type to markdown does not throw an error.

Client:

  • Python Library
Originally created by @johnisanerd on GitHub (Sep 6, 2024). Originally assigned to: @BinaryBrain on GitHub. I get the following output when I run this code: ``` documents = LlamaParse( result_type="json", split_by_page=False, parsing_instruction=extraction_instructions ).load_data(pdf_path) ``` Gives the error: ``` Started parsing the file under job_id 6e516bf7-de76-4f0a-85be-da416364a5ca Error while parsing the file '18f0aecc51523b1b_attachment_2.pdf': 'json' ``` This returns: `[]` Verbose does not seem to expand the error message. Changing the result_type to markdown does not throw an error. **Client:** - Python Library
yindo added the bug label 2026-02-16 00:17:17 -05:00
yindo closed this issue 2026-02-16 00:17:17 -05:00
Author
Owner

@BinaryBrain commented on GitHub (Sep 6, 2024):

Hi @johnisanerd,
It's a bug. Your job was already cached, the cache was restored but you should see the retrieved json.

@BinaryBrain commented on GitHub (Sep 6, 2024): Hi @johnisanerd, It's a bug. Your job was already cached, the cache was restored but you should see the retrieved json.
Author
Owner

@johnisanerd commented on GitHub (Sep 6, 2024):

Should I be able to re-run this code now and see json coming out?

@johnisanerd commented on GitHub (Sep 6, 2024): Should I be able to re-run this code now and see json coming out?
Author
Owner

@katzurik commented on GitHub (Sep 11, 2024):

Had the same issue, can't manage to use the API with json type. Any workaround?

@katzurik commented on GitHub (Sep 11, 2024): Had the same issue, can't manage to use the API with json type. Any workaround?
Author
Owner

@BinaryBrain commented on GitHub (Sep 11, 2024):

@katzurik The API is working on my side. Can you provide your code?

@BinaryBrain commented on GitHub (Sep 11, 2024): @katzurik The API is working on my side. Can you provide your code?
Author
Owner

@katzurik commented on GitHub (Sep 11, 2024):

@katzurik The API is working on my side. Can you provide your code?

import json
from llama_parse import LlamaParse
import os

api_key= ''

parser = LlamaParse(
api_key=api_key,
result_type="json",
num_workers=4,
verbose=True,
language="en",
)

documents = parser.load_data(file_path)

Output:
Started parsing the file under job_id ..some job_id ...
Error while parsing the file 'some file.pdf': 'json'

@katzurik commented on GitHub (Sep 11, 2024): > @katzurik The API is working on my side. Can you provide your code? import json from llama_parse import LlamaParse import os api_key= '' parser = LlamaParse( api_key=api_key, result_type="json", num_workers=4, verbose=True, language="en", ) documents = parser.load_data(file_path) Output: Started parsing the file under job_id ..some job_id ... Error while parsing the file 'some file.pdf': 'json'
Author
Owner

@BinaryBrain commented on GitHub (Sep 13, 2024):

Hmm, I agree we have an issue with types in the lib. Will patch it.
For JSON output, you're supposed to use:

json_objs = parser.get_json_result(file_path)
json_list = json_objs[0]["pages"]

See this example: https://github.com/run-llama/llama_parse/blob/main/examples/demo_json.ipynb

@BinaryBrain commented on GitHub (Sep 13, 2024): Hmm, I agree we have an issue with types in the lib. Will patch it. For JSON output, you're supposed to use: ```py json_objs = parser.get_json_result(file_path) json_list = json_objs[0]["pages"] ``` See this example: https://github.com/run-llama/llama_parse/blob/main/examples/demo_json.ipynb
Author
Owner

@AndreaLRM commented on GitHub (May 9, 2025):

Hi, I had the same issue. No idea how to get the retrieved json file. Also, the link for the demo_json notebook you provided is broken.

@AndreaLRM commented on GitHub (May 9, 2025): Hi, I had the same issue. No idea how to get the retrieved json file. Also, the link for the demo_json notebook you provided is broken.
Author
Owner

@BinaryBrain commented on GitHub (May 12, 2025):

Hi @AndreaLRM,
We now have a new way of getting data that's should be more user-friendly: https://github.com/run-llama/llama_cloud_services/blob/main/examples/parse/demo_json_tour.ipynb

@BinaryBrain commented on GitHub (May 12, 2025): Hi @AndreaLRM, We now have a new way of getting data that's should be more user-friendly: https://github.com/run-llama/llama_cloud_services/blob/main/examples/parse/demo_json_tour.ipynb
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: run-llama/llama_cloud_services#256