Skip to main content
All AI tricks
Guided workflowDevelopmentIntermediate

Ollama: Check Local JSON Output

Run a small local model task with Ollama and validate the requested JSON fields. Separate a syntactically valid response from a correct extraction.

15 min practiceOllamaUpdated · Last checked Oct 9, 2026
Jump to the lesson ↓
Local JSON Checks: Schema → Generate → Validate.
Original Genius Forges workflow diagram. Conceptual illustration, not a provider screenshot or product test.

The useful result

Extract two known fields with a local model and independently check syntax and values.

  • Extract two known fields with a local model and independently check syntax and values.
  • Inspect the supplied example and identify a result that fails the task.

Ollama’s local runtime and API support model experiments without requiring a hosted inference subscription for local use. The useful trick is to test output syntax and content separately. This lesson uses a small CLI exercise and synthetic data; it does not install an API-backed application or call a paid provider.

Reviewed on 9 October 2026 against the linked official sources. These instructions teach a bounded practice task; account features and limits can differ. Expected outputs are illustrative rather than captured AI runs. Keep original inputs and verify the result before using it.

Before you start

  • Ollama installed through its official operating-system instructions
  • A downloaded compatible model that fits your computer
  • Basic terminal familiarity; no API key or real customer data needed

Review evidence

Documentation-based review · 2026-10-09

Official capabilities checked; exercise prompts and expected outputs are original illustrative teaching material.

1

Confirm the model and local route

Use the official quickstart for your system. List the installed models and choose a small supported local model. Record its exact name. Download first; an offline test cannot download missing weights.

Example / expected result

Illustrative example (not a recorded model result): Run ollama list to see installed model names. Use ollama run with the exact local model name you selected.

Check your result

Check that the selected model is downloaded and that you are not using a cloud-only route.

2

Give a tiny extraction task

Use a prompt with two fields and an exact allowed value. This makes an incorrect answer easy to detect. Treat any formatting instruction as a request whose output still needs validation.

Try this prompt
Extract from this text only: Fix checkout typo; priority low. Return a JSON object with exactly title and priority. No commentary or Markdown fences. Unknown values must be null.

Example / expected result

Illustrative example (not a recorded model result): {"title":"Fix checkout typo","priority":"low"}

Check your result

Check the returned keys and values. An added owner or deadline is outside the task.

3

Check syntax separately from meaning

Copy the candidate response into a JSON validator you trust, or parse it in your normal local development environment. Do not execute generated shell commands. A JSON parser checks syntax, not whether the model copied the right values.

Example / expected result

Illustrative example (not a recorded model result): {"title":"Fix checkout typo","priority":"high"} is valid JSON but fails the extraction because the input says low.

Check your result

Confirm valid JSON, exactly two keys, correct title and priority equal to low.

4

Test the missing-field case

Repeat with a note containing no priority. Check that missing information becomes null instead of a guessed label. Save both inputs and the model name for a reproducible small comparison.

Try this prompt
Extract from this text only: Review the wireframe. Return exactly title and priority as JSON. Do not infer priority; missing values must be null.

Example / expected result

Illustrative example (not a recorded model result): {"title":"Review the wireframe","priority":null}

Check your result

Reject an invented medium priority. Passing two cases is a useful start, not evidence of general extraction accuracy.

When it goes wrong

A small local model may add Markdown fences or invent a label. Narrow the brief and validate the result; do not silently accept it because it parsed. Speed and quality depend on hardware and the model. Model licensing is separate from the Ollama runtime.

Make it your own

Create five synthetic notes, including two missing priorities and one contradictory note. Define the expected handling before running the model and record failures.

Useful next resources

Sources and review

Last checked Oct 9, 2026. Features and account limits can change. Verify important results against your original material.

Did this help you complete your task?

Tell us what needs improving. No account or private output required.

Was this useful?
Report incorrect information or a broken link

Genius Forges Editorial

Practical, documentation-reviewed AI exercises with explicit examples and independent result checks.

Keep building your AI habits

Keep learning useful AI tricks

Get practical lessons and resources when we publish them.

Turn this idea into a daily skill

Practice with a small input and check the result before sharing.

We use optional cookies for analytics and referral tracking. Learn more about our privacy policy