Skip to main content
Participant
August 10, 2023
Answered

Include tables within JSON object & remove Bounds, ClipBounds, Font

  • August 10, 2023
  • 1 reply
  • 857 views

Hi,

 

I would like to output a JSON object that has table data imbedded within it. I also want a clean object that has Headers, Tables, Paragraphs, and little else. I do not want to maintain the Bounds, ClipBounds, or Font objects.

 

Can anyone tell me how I can get the desire output using the API?

 

Thanks so much!

 

    Correct answer Raymond Camden

    Hi, I don't want to have to parse JSON objects individually. I'm looking for a scripted way to do this.


    Um, I'm not sure what to tell you. Are you asking how to work with the JSON response? If so, I would consult the docs for your platform. There are standard ways to loop over data, check values, etc. Our API returns everything with the idea being that you will use what you need. There is no option to 'shape' the data in the API as the expectation is that a developer can do that themselves. 

    1 reply

    Participant
    August 10, 2023

    Hi, 

    I thought it would be helpful to add some more context.

     

    I'm using the PDF extract API, with the following ExtractPDFOptions:

     

    extract_pdf_options: ExtractPDFOptions = ExtractPDFOptions.builder() \
    .with_element_to_extract(ExtractElementType.TEXT) \
    .with_element_to_extract(ExtractElementType.TABLES) \
    .build()
    extract_pdf_operation.set_options(extract_pdf_options)

    This is outputting tables as .xlsx and referencing them within the JSON output, e.g. the Bounds, ClipBounds, and BBox
     
    "filePaths": [
    "tables/fileoutpart0.xlsx"
     
    And it includes a lot of output that will not be useful for my project, e.g. the Bounds, ClipBounds, and BBox properties in this section of the JSON object:
     
    {
    "Bounds": [
    42.75,
    73.17599487304688,
    568.8930053710938,
    500.4459991455078
    ],
    "ClipBounds": [
    42.75,
    73.17599487304688,
    568.8930053710938,
    500.4459991455078
    ],
    "Page": 5,
    "Path": "//Document/Table",
    "attributes": {
    "BBox": [
    42.47829999999885,
    73.82919999999649,
    570.2169999999751,
    498.9719999999943
    ],
    "NumCol": 3,
    "NumRow": 36,
    "Placement": "Block",
    "SpaceAfter": 9.75
    },
    "filePaths": [
    "tables/fileoutpart0.xlsx"
    ]
    },
    Raymond Camden
    Community Manager
    Community Manager
    August 10, 2023

    You can manipulate the JSON returned from the API for any purpose - so why not simply do that? I may be missing your point though.

    Participant
    August 11, 2023

    Hi, I don't want to have to parse JSON objects individually. I'm looking for a scripted way to do this.