Pricing
from $10.00 / 1,000 results
Code Converter Toolkit
A universal code conversion actor that transforms between 6 popular code formats in a single run. Supports both single and batch conversions with structured JSON output.
Pricing
from $10.00 / 1,000 results
Rating
0.0
(0)
Developer
Actor stats
0
Bookmarked
2
Total users
1
Monthly active users
2 months ago
Last modified
Categories
Share
๐ Code Converter Toolkit โ Apify Actor
A universal code conversion actor that transforms between 6 popular code formats in a single run. Supports both single and batch conversions with structured JSON output.
Supported Conversions
| # | From | To | Key |
|---|---|---|---|
| 1 | HTML | Markdown | html_to_markdown |
| 2 | Markdown | HTML | markdown_to_html |
| 3 | CSS | Tailwind Classes | css_to_tailwind |
| 4 | SQL DDL | ORM Models (Python + JS) | sql_to_orm |
| 5 | JSON | TypeScript Interfaces | json_to_typescript |
| 6 | JSON | Python Dataclasses | json_to_dataclass |
Input Schema
Single Conversion (Default)
{"conversion_type":"html_to_markdown","source_code":"<h1>Hello</h1><p>World</p>","root_class_name":"Root","orm_target":"both"}
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
conversion_type | string (enum) | โ | "html_to_markdown" | Which conversion to run |
source_code | string | โ | (HTML demo) | The source code to convert |
root_class_name | string | โ | "Root" | Class/interface name (JSON converters only) |
orm_target | string (enum) | โ | "both" | "both" / "sqlalchemy" / "sequelize" |
Batch Conversion
Provide batch_conversions to run multiple conversions in one actor call.
When batch is provided, the single-mode fields are ignored.
{"batch_conversions":[{"conversion_type":"html_to_markdown","source_code":"<h1>Title</h1><p>Paragraph</p>"},{"conversion_type":"json_to_typescript","source_code":"{\"name\": \"Alice\", \"age\": 30}","root_class_name":"User"},{"conversion_type":"css_to_tailwind","source_code":".box { display: flex; padding: 1rem; gap: 0.5rem; }"},{"conversion_type":"sql_to_orm","source_code":"CREATE TABLE users (id SERIAL PRIMARY KEY, name VARCHAR(100) NOT NULL);","orm_target":"sqlalchemy"}]}
Output
Each conversion produces a structured result in the default dataset:
{"index":0,"conversion_type":"html_to_markdown","label":"HTML โ Markdown","input_lang":"html","output_lang":"markdown","source_code":"<h1>Hello</h1>...","converted_output":"# Hello\n\n...","success":true,"error":null,"timestamp":"2025-01-15T12:00:00+00:00"}
Additionally:
- Key-Value Store โ
RUN_SUMMARY: Aggregated stats (total, success, fail counts) - Key-Value Store โ
OUTPUT_0_html_to_markdown.md: Individual output files with correct extensions
Conversion Details
1. HTML โ Markdown
Converts semantic HTML into clean Markdown. Handles headings, bold/italic, links, images, code blocks, blockquotes, ordered/unordered lists, horizontal rules, and GFM-style tables.
2. Markdown โ HTML
Parses Markdown syntax into semantic HTML5. Supports headings, inline formatting, fenced code blocks with language hints, blockquotes, lists, pipe tables, links, images, and horizontal rules.
3. CSS โ Tailwind Classes
Maps 50+ CSS properties to Tailwind utility classes including display, position, flexbox, grid, spacing (margin/padding), typography, colors, borders, shadows, transforms, and more. Uses Tailwind's arbitrary value syntax [value] for unmapped values.
4. SQL โ ORM Models
Parses CREATE TABLE DDL statements and generates:
- Python SQLAlchemy ORM model classes
- JavaScript Sequelize model definitions
Supports: INT, VARCHAR, TEXT, BOOLEAN, TIMESTAMP, SERIAL, JSON, UUID, BLOB, etc.
Constraints: PRIMARY KEY, NOT NULL, UNIQUE, DEFAULT, REFERENCES (foreign keys).
5. JSON โ TypeScript Interfaces
Recursively infers TypeScript export interface definitions from JSON objects/arrays. Detects nested objects, arrays of objects (with singular naming), union types for mixed arrays, and optional fields for null values.
6. JSON โ Python Dataclass
Generates Python @dataclass definitions with:
- Recursive nested class generation
Optional[]typing for nullable fieldsfrom_dict()classmethod with nested object reconstructionto_dict()method (viadataclasses.asdict)from_json()classmethod for direct string deserialization
Running Locally
# Install the Apify CLInpminstall-g apify-cli# Navigate to the actor directorycd apify-actor# Create local storageapify init# Run with default inputapify run# Run with custom inputapify run --input='{"conversion_type":"css_to_tailwind","source_code":".card{display:flex;padding:1rem;}"}'
Example Inputs by Type
HTML โ Markdown
{"conversion_type":"html_to_markdown","source_code":"<h1>Blog Post</h1><p>Hello <strong>world</strong>!</p><ul><li>Item 1</li><li>Item 2</li></ul>"}
CSS โ Tailwind
{"conversion_type":"css_to_tailwind","source_code":".container { display: flex; flex-direction: column; align-items: center; padding: 2rem; gap: 1rem; background-color: #ffffff; border-radius: 0.5rem; }"}
SQL โ ORM
{"conversion_type":"sql_to_orm","source_code":"CREATE TABLE products (id SERIAL PRIMARY KEY, name VARCHAR(200) NOT NULL, price DECIMAL(10,2), category_id INTEGER REFERENCES categories(id), created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP);","orm_target":"both"}
JSON โ TypeScript
{"conversion_type":"json_to_typescript","source_code":"{\"id\": 1, \"name\": \"Widget\", \"price\": 29.99, \"tags\": [\"sale\", \"new\"], \"dimensions\": {\"width\": 10, \"height\": 20}}","root_class_name":"Product"}
JSON โ Dataclass
{"conversion_type":"json_to_dataclass","source_code":"{\"id\": 1, \"name\": \"Widget\", \"price\": 29.99, \"in_stock\": true, \"metadata\": null}","root_class_name":"Product"}
Tech Stack
- Runtime: Python 3.11
- Platform: Apify SDK v2
- Dependencies: Zero external deps for converters (stdlib only)
- Docker:
apify/actor-python:3.11
License
MIT
