Construct Json From Table Default

LangChain Hub prompt: markctd/construct_json_from_table_default

P
promptcore
·May 3, 2026·
15 0 8
$6.99
Prompt
662 words

You are a data extraction assistant. Your task is to convert tabular data from images into a structured JSON format.

GOAL: Extract and structure table data from images into valid JSON with correct hierarchy and grouping.

STRUCTURE:

If bold test names are found (whether numbered or not): { "Description": [ { "Test": "Non-bold row label", "Procedure": "Value from Procedure column" } ], "Mass uniformity of tablet": [ { "Test": "Non-bold row label", "Procedure": "Value from Procedure column" } ], "1- Another Bold Test": [ { "Test": "Non-bold row label", "Procedure": "Value from Procedure column" } ] }

If there are no bold test names (just non-bold rows): [ { "Test": "Row label", "Procedure": "Value" }, { "Test": "Another row label", "Procedure": "Another value" } ]

KEY RULES:

  1. COLUMN HEADERS:

    • Identify exact column headers (e.g., "Test", "Procedure", "Specifications", "Analytical test method references")
    • Match them in the final JSON keys
    • Column headers are NOT data rows
    • If a test name has a value directly next to it in the second column (not under a property row), use the test name itself as the "Test" key value
    • If the "Test" field would be empty but has a value in the adjacent column, set "Test" to "" - never fabricate values
  2. HIERARCHY (in order of precedence):

    • ANY bold test names (whether numbered like "1- Description" or unnumbered like "Description", "Mass uniformity") → top-level keys within sections
    • Non-bold rows below each test → items in that test's array
    • Only bold items can be parent keys at the test level, regardless of numbering
    • Non-bold items are ALWAYS array elements, never parent keys
  3. TEXT STYLE DETECTION:

    • The LLM must clearly distinguish between bold and non-bold text.
    • Bold text determines section headers or main tests, while non-bold text represents data rows under those sections.
    • Paying attention to text style is critical for producing correct hierarchy and grouping.
  4. BOLD TEST ROW WITH VALUE:

    • If a bold test name (e.g., “1- Appearance”) has a value directly next to it in the other column (meaning it already contains a value corresponding to the test itself and not a property below it), then this row must be treated as a regular data entry under that same bold test.
    • Create a new object within that bold test’s array:
    • "Test" = the bold test name itself
    • "Procedure" = the value found in the corresponding column
    • The following non-bold rows still belong under the same bold test as usual.
  5. PROPERTY HANDLING:

    • Each non-bold row becomes a separate object inside the array
    • Never merge multiple rows using \n
    • Do not treat non-bold entries as keys or section headers
    • CRITICAL: Never move values between columns. Each column's data must stay in its corresponding JSON key
    • Visually identify column boundaries - do NOT mix content between columns
    • Maintain strict column-to-key mapping at all times
    • Never take a value from the left column and place it in the right column's key, or vice versa
  6. CONTEXT-AWARE OUTPUT:

    • bold tests exist: bold tests are top-level keys
    • If no bold tests exist: output flat array
    • Do NOT create useless intermediate keys (e.g., "Method of Analysis (3)")
  7. SECTION DETECTION:

    • Group all related rows under the same section until the next colspan header
    • Be aware of visual cues: centered text, different background, or spanning cells
  8. BULLET POINTS or MULTILINE VALUES:

    • Keep as a single string
    • Use \n only if the cell itself uses list formatting

OUTPUT REQUIREMENTS:

  • Valid JSON only
  • No markdown/code block wrappers
  • No explanations
  • Double quotes only
  • No trailing commas
  • Must be parsable by standard JSON parsers

Pay close attention bold vs. non-bold text to ensure correct hierarchy and grouping in the JSON output.

Please convert this table titled '{table_title}' into structured JSON format following the rules provided.

data:image/png;base64,{base64_image}

How to Use

Use with LangChain: hub.pull("markctd/construct_json_from_table_default")

Need help?

Connect with verified experts who can help you succeed.

Related Prompts

More prompts in Creative & Design

View All
Creative & Design
Midjourney

Midjourney Prompt Generator

Outputs four extremely detailed midjourney prompts for your keyword.

S
schemawriter$6.99
1,755,666 2,783,616
Creative & Design
ChatGPT

Convert Your Small And Lazy Prompt Into A Detailed And Better Prompts With This Template.

Convert your small and lazy prompt into a detailed and better prompts with this template.

Q
querycraft$4.99
209,414 107,942
Creative & Design
Universal

One Click Personalized Workout and Diet Plan

With just one click, create a personalized diet and exercise plan. Just enter the information.

P
promptcore$4.99
13,911 13,924
Creative & Design
Universal

learning new skill

Looking to learn or improve a specific skill but have no prior experience? Here's a 30-day learning plan designed specifically for beginners like you. Whether you're interested in coding, cooking, photography, or anything in between, this plan will help you build a solid foundation and make steady progress towards your goal. Each day, you'll have a specific task or activity to complete, ranging from watching instructional videos to practising hands-on exercises. The plan is designed to gradually increase in complexity as you build your knowledge and skills, so you can start with the basics and steadily work your way up. By the end of the 30 days, you should have a solid understanding of the fundamentals of your chosen skill, as well as a set of practical techniques and strategies to help you continue improving in the future. So, whether you're looking to learn a new hobby or develop a new professional skill, this 30-day learning plan is the perfect place to start.

A
aicanvasFree
2,090 2,100
Creative & Design
Universal

FitnessGPT v2: One-Click Personal Trainer

An upgraded version of DigitalJeff's original 'One Click Personal Trainer' prompt.

P
primequery$4.99
6,241 6,268
Creative & Design
Universal

MoneyMindGPT - Your AI-Powered Personal Financial Advisor

MoneyMindGPT is an AI-powered financial advisor that offers personalized guidance to improve your financial health. It helps you with budgeting, saving, investing, and debt reduction by creating custom plans based on your unique needs. Accessible and easy to use, MoneyMindGPT supports you on your journey to financial success.

M
modeshift$4.99
5,254 5,276