- Home
- Skills
- Data & Databases
- Freebies — Json To Sql Converter
Works with the AI Agents you already use
Freebies — Json To Sql Converter
Convert arbitrary JSON objects and nested arrays into normalized PostgreSQL or MySQL relational schemas.
Free
Freebies — Json To Sql Converter
Example session with this skill installed
Generate a normalized PostgreSQL schema from this JSON user profile: {"id": 1, "name": "Dev", "roles": ["admin", "editor"], "metadata": {"last_login": "2023-10-01T12:00:00Z"}}
- Read your context and instructions
- Compiled the freebies
I have analyzed the JSON structure. The `roles` array has been normalized into a separate child table, and the `metadata` object has been mapped to a JSONB column. ## SQL Migration Schema ```sql -- Main user profiles table CREATE TABLE IF NOT EXISTS users ( id SERIAL PRIMARY KEY, name VARCHAR(255) NOT NULL, metadata JSONB, created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP ); -- Normalized roles table (1-to-many) CREATE TABLE IF NOT EXISTS user_roles ( id SERIAL PRIMARY KEY, user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE, role_name VARCHAR(50) NOT NULL ); -- Index recommendations for performance CREATE INDEX idx_users_metadata ON users USING GIN (metadata); CREATE INDEX idx_user_roles_user_id ON user_roles(user_id); ``` **Next steps** 1. Review the `VARCHAR` lengths to match your specific data requirements. 2. Apply these statements to your PostgreSQL instance using a migration tool or `psql`. 3. If you need to handle more complex nested objects, provide a larger JSON sample for recursive normalization.
Connects securely to your tools. The creator never sees your data.
About this skill
Manually mapping JSON blobs to relational schemas is tedious and prone to normalization errors. This skill automates the transition from document-based data to structured SQL, ensuring your schemas follow relational best practices. ## What it does - **Structure analysis** evaluates JSON data types, nullability, and nested structures to determine the optimal schema. - **Automatic normalization** flattens nested arrays into separate one-to-many child tables with appropriate foreign keys. - **Type mapping** converts JSON types to target SQL types like `VARCHAR`, `NUMERIC`, and `JSONB`. - **DDL generation** produces clean `CREATE TABLE` statements including index recommendations for performance. ## How it works 1. **Provide JSON** input by pasting a sample object or pointing to a file in the workspace. 2. **Review normalization** as the skill identifies nested objects that require relational separation. 3. **Generate DDL** to receive a complete SQL script with primary keys, foreign keys, and indexes. ## Frameworks & tools The skill generates valid DDL statements optimized for PostgreSQL and MySQL. ## Why this beats prompting it yourself Generic prompts often fail to normalize nested arrays correctly, resulting in "God tables" or lost data. This skill follows a deterministic workflow to enforce 1:N relationships and optimal indexing by default. ## Use cases - Migrating legacy NoSQL data or API responses to a relational database. - Scaffolding a database schema from frontend JSON mockups. - Prototyping data models for PostgreSQL or MySQL projects. - Automating the creation of child tables for complex nested document structures. ## Known limitations Restricted to PostgreSQL and MySQL dialects. Execution is confined to the local workspace for file operations.
Supports PostgreSQL and MySQL dialects only. Cannot access files outside the current project directory.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Free forever
No account required to browse
Trust & safety
Security scan
Security scan passed 2 days ago
- Free with an Agensi account
Requires
Permissions
Target Use Cases: - Convert this JSON object into SQL CREATE TABLE statements. - Infer relational database schema from JSON data. - Transform nested JSON into normalized SQL tables.