Dev Tools Guide:JSON Schema, LLMs & Mock Data

JSON Schema generation, typed code from JSON, LLM token counting, prompt formatting, and mock data — the tools that power modern API and AI development workflows.

Modern Dev Tools: JSON, LLMs, and Mock Data

The tools developers reach for have shifted dramatically in the past three years. API type generation from JSON responses. Token counting for LLM cost estimation. Structured prompt formatting. Mock data generation for testing. These aren't niche tools — they're part of the daily workflow for developers building with APIs, working with AI models, and testing against realistic data. This guide covers the newest toolset on this site: JSON utilities for schema generation and type conversion, LLM tools for token counting and prompt formatting, and a mock data generator for testing and prototyping.

JSON Schema: From Example Data to Validation Rules

You have a JSON response from an API. You need to validate incoming requests against the same structure. Writing a JSON Schema by hand is tedious — tracking every field, nesting level, and type constraint across hundreds of lines. The JSON Schema Generator reverses the process: paste example JSON, and it outputs a complete JSON Schema that describes the structure. The schema includes type definitions, required field lists, and nested object schemas.

JSON Schema is the foundation of API validation. OpenAPI uses it for request/response definitions. Postman uses it for test assertions. Most backend frameworks (FastAPI, Express with ajv, Spring Boot) support JSON Schema validation directly. Starting from generated schema is faster than writing from scratch. The generator handles structural inference — you add semantic details like format constraints (email, uri, date-time), enum values, and field descriptions. For converting the same JSON into typed code, use the JSON to Code tool.

JSON to Code: Type-Safe API Responses

Calling an API that returns JSON is easy. Using that JSON safely in a typed language requires type definitions. The JSON to Code converter generates TypeScript interfaces, Go structs, Rust structs, Kotlin data classes, or Dart classes from a JSON response. Paste the JSON, pick your language, and get typed code that matches the API's actual response shape — not the documented shape (which is often outdated), but what the API actually returns.

This is the fastest way to create typed API clients. Run the API endpoint, copy the response, paste it into the converter, and get type-safe code. For TypeScript, the generated interfaces work directly with fetch/axios responses. For Go, the struct tags include json field mappings. For Rust, the output includes serde derive macros. For Kotlin and Dart, the generated data classes work with standard JSON serialization. The tool infers types from values: strings become String, numbers become Int or Float (auto-detected), booleans become Bool, and arrays use the correct generic syntax for each language.

LLM Token Counting: Budgeting API Costs

Every LLM API charges by the token. A 10,000-token prompt to GPT-4o costs $0.025. The same prompt to Claude Sonnet 4 costs $0.03. A 100,000-token document summarization task costs 10x that. Token counting isn't just about cost — it's about whether your prompt fits in the model's context window at all. GPT-4o supports 128K tokens. Claude supports 200K. Gemini Flash supports 1M. A document that fits in Gemini might not fit in GPT-4o.

The LLM Token Counter estimates token counts for major models. Paste your text, see the estimated tokens, characters, and approximate cost. The estimation uses character-based heuristics (~4 chars/token for OpenAI, ~3.5 for Anthropic, ~4 for Google) which are accurate within 10-15% for English. For precise counts, use the official tokenizer libraries (tiktoken for Python, Anthropic's tokenizer for Node). For structuring your prompts before counting tokens, use the Prompt Tools.

Prompt Formatting: Structure Produces Better Results

LLMs respond to structure. A prompt that says "write a function to sort an array" produces generic output. A prompt with sections for Role, Task, Context, and Output Format produces output tailored to your specific needs. The Prompt Tools formatter adds these structural elements automatically. It doesn't change your prompt's content — it organizes it into a format that LLMs process more effectively.

The format action wraps your prompt in a template with sections for Role, Task, Context, Output Format, and Constraints. The clean action removes extra whitespace and normalizes formatting. The template action creates a reusable prompt template with placeholder sections. These are simple text transformations, not AI-powered optimization — they improve prompt structure, not prompt content. For semantic improvements, ask the LLM itself with a meta-prompt.

Mock Data: Testing Without Production Data

Testing with real user data is a privacy risk. Testing with an empty database catches no bugs. Mock data fills the gap. The Mock Data Generator creates realistic fake datasets with configurable fields and types: names, emails, UUIDs, dates, numbers, booleans. Define your schema, set the record count, and get a JSON array ready for API mocking, database seeding, or test fixtures.

Combine the mock generator with the JSON Formatter to validate the output, the JSON Schema Generator to create validation rules, and the JSON to Code converter to generate typed interfaces for your mock data. The tools chain together: generate data → validate structure → create types → build your API client. For more generic string generation, use the Random String Generator. For password and token generation, use the Password Generator.