{}
StrictJSON
Extraction

Book / ISBN Extractor

Libraries, bookstores, and second-hand sellers all face the same chore: turning messy catalog copy into clean, structured records. Paste a catalog entry — a back-cover blurb, a publisher listing, or a scanned shelf label — and get back the title, the author, and the ISBN, ready to drop into a database or an inventory spreadsheet. The hard part is the ISBN itself. It may arrive with or without its literal prefix (“ISBN”, “ISBN-10”, or “ISBN-13”), with hyphens, spaces, or none at all; an ISBN-10 can even end in the letter X, which is a valid check digit, not a typo. Different editions of the same book share a title and an author but never an ISBN, so the number is the only reliable key. This prompt refuses to guess: if any of the three fields is missing from the entry, it produces no output at all rather than inventing one.

System Prompt

You are a precise book extraction engine. Read the provided library catalog entry and return ONLY a valid JSON object matching the schema below. Do not add explanations, markdown, or extra fields. Every field is required: title, author, and isbn. Extract the best value printed in the entry and never invent a value that is not printed. Never use null or an empty string for a required field. The isbn must be the full ISBN-10 or ISBN-13 exactly as printed, keeping its hyphens or spaces; it may start with the literal prefix "ISBN", "ISBN-10", or "ISBN-13" followed by a space or a colon. If any required field (title, author, or isbn) cannot be found in the entry, do not produce any output.

Raw JSON Schema

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "additionalProperties": false,
  "properties": {
    "author": {
      "minLength": 1,
      "type": "string"
    },
    "isbn": {
      "minLength": 1,
      "pattern": "^(?:ISBN(?:-1[03])?:?\\s*)?(?:(?:\\d[-\\s]?){9}[\\dX]|(?:\\d[-\\s]?){12}\\d)$",
      "type": "string"
    },
    "title": {
      "minLength": 1,
      "type": "string"
    }
  },
  "required": [
    "title",
    "author",
    "isbn"
  ],
  "title": "BookIsbn",
  "type": "object"
}

Zod (TypeScript)

import { z } from "zod";

export const BookIsbnSchema = z
  .object({
    title: z.string().min(1),
    author: z.string().min(1),
    isbn: z
      .string()
      .min(1)
      .regex(
        /^(?:ISBN(?:-1[03])?:?\s*)?(?:(?:\d[-\s]?){9}[\dX]|(?:\d[-\s]?){12}\d)$/
      ),
  })
  .strict();

Pydantic v2 (Python)

from pydantic import BaseModel, Field, field_validator


class BookIsbn(BaseModel):
    title: str = Field(..., min_length=1)
    author: str = Field(..., min_length=1)
    isbn: str = Field(
        ...,
        min_length=1,
        pattern=r"^(?:ISBN(?:-1[03])?:?\s*)?(?:(?:\d[-\s]?){9}[\dX]|(?:\d[-\s]?){12}\d)$",
    )

    @field_validator("title", "author", "isbn", mode="before")
    @classmethod
    def _strip_strings(cls, v):
        if not isinstance(v, str):
            return v
        return v.strip()

Try it in the StrictJSON tool →