VOOZH about

URL: https://apify.com/moving_beacon-owner1/my-actor-64

โ‡ฑ Code Converter Toolkit ยท Apify


Pricing

from $10.00 / 1,000 results

Go to Apify Store

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

๐Ÿ‘ Jamshaid Arif

Jamshaid Arif

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

2 months ago

Last modified

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

#FromToKey
1HTMLMarkdownhtml_to_markdown
2MarkdownHTMLmarkdown_to_html
3CSSTailwind Classescss_to_tailwind
4SQL DDLORM Models (Python + JS)sql_to_orm
5JSONTypeScript Interfacesjson_to_typescript
6JSONPython Dataclassesjson_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"
}
FieldTypeRequiredDefaultDescription
conversion_typestring (enum)โœ…"html_to_markdown"Which conversion to run
source_codestringโœ…(HTML demo)The source code to convert
root_class_namestringโŒ"Root"Class/interface name (JSON converters only)
orm_targetstring (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 fields
  • from_dict() classmethod with nested object reconstruction
  • to_dict() method (via dataclasses.asdict)
  • from_json() classmethod for direct string deserialization

Running Locally

# Install the Apify CLI
npminstall-g apify-cli
# Navigate to the actor directory
cd apify-actor
# Create local storage
apify init
# Run with default input
apify run
# Run with custom input
apify 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

You might also like

Universal Data Structure Converter

moving_beacon-owner1/my-actor-63

A production-grade Apify actor that converts between HTML, XML, CSV, YAML, and JSON formats. Supports 9+ conversion types with smart auto-detection, nested JSON flattening, HTML table scraping, batch URL processing, and full customization.

2

Smart Data Converters

moving_beacon-owner1/my-actor-65

A versatile 5-in-1 data conversion actor that intelligently transforms data between formats. Every converter includes sensible defaults in the input schema so you can run it instantly without any configuration.

2

Unit Converter Input

moving_beacon-owner1/unit-converter-input

A versatile tool to **convert numeric values between different units**, with support for **single and batch conversions**. Works for length, weight, temperature, volume, and more.

2

API Integration Toolkit

moving_beacon-owner1/my-actor-67

A Swiss-army knife for API developers. Convert between API formats with production-grade, well-documented output code.

2

AI Code Reviewer - Analyze, Explain & Improve Code

ntriqpro/code-review-intelligence-mcp

Get AI-powered feedback on code quality, security issues, and improvement suggestions. Explain complex code in plain English.

LinkedIn Conversions API - B2B Offline Attribution

alizarin_refrigerator-owner/linkedin-conversions-api---b2b-offline-attribution

Send offline conversions to LinkedIn Conversions API for B2B campaign attribution. Track leads, signups & purchases w/automatic email hashing. Conversion Send a conversion event Send multiple conversions List all conversion rules Get rule details Create new conversion rule Get conversion statistics

Example Code Runner (Playwright)

apify/example-code-runner-playwright

Generic Actor to run code examples from the documentation via "Run on Apify" links.

Related articles

Single JavaScript file Actors are being deprecated
Read more