MCP HubMCP Hub
スキル一覧に戻る

data-type-converter

majiayu000
更新日 Today
22 閲覧
58
9
58
GitHubで表示
その他data

について

このClaude Skillは、JSON、CSV、XML、YAML、TOML形式間でのデータ変換を行います。ネストされた構造や配列を適切に処理し、可能な限りデータ型を保持します。JSONのCSVへの平坦化や、異なる形式間での設定のシリアライズなど、迅速なデータ変換タスクにご利用いただけます。

クイックインストール

Claude Code

推奨
プラグインコマンド推奨
/plugin add https://github.com/majiayu000/claude-skill-registry
Git クローン代替
git clone https://github.com/majiayu000/claude-skill-registry.git ~/.claude/skills/data-type-converter

このコマンドをClaude Codeにコピー&ペーストしてスキルをインストールします

ドキュメント

Data Type Converter

Convert data between JSON, CSV, XML, YAML, and TOML formats. Handles nested structures, arrays, and complex data with intelligent flattening options.

Quick Start

from scripts.data_converter import DataTypeConverter

# JSON to CSV
converter = DataTypeConverter()
converter.convert("data.json", "data.csv")

# YAML to JSON
converter.convert("config.yaml", "config.json")

# With options
converter.convert("data.json", "data.csv", flatten=True)

Features

  • 5 Formats: JSON, CSV, XML, YAML, TOML
  • Nested Data: Flatten or preserve nested structures
  • Arrays: Handle array data intelligently
  • Type Preservation: Maintain data types where possible
  • Pretty Output: Formatted, human-readable output
  • Batch Processing: Convert multiple files

API Reference

Basic Conversion

converter = DataTypeConverter()

# Auto-detect format from extension
converter.convert("input.json", "output.csv")
converter.convert("input.xml", "output.json")
converter.convert("input.yaml", "output.toml")

With Options

# Flatten nested structures for CSV
converter.convert("nested.json", "flat.csv", flatten=True)

# Pretty print output
converter.convert("data.json", "pretty.json", indent=4)

# Specify root element for XML
converter.convert("data.json", "data.xml", root="records")

Programmatic Access

# Load and convert in memory
data = converter.load("data.json")
converter.save(data, "data.yaml")

# String conversion
json_str = '{"name": "John", "age": 30}'
yaml_str = converter.convert_string(json_str, "json", "yaml")

Batch Processing

# Convert all JSON files to CSV
converter.batch_convert(
    input_dir="./json_files",
    output_dir="./csv_files",
    output_format="csv"
)

CLI Usage

# Basic conversion
python data_converter.py --input data.json --output data.csv

# With flattening
python data_converter.py --input nested.json --output flat.csv --flatten

# Batch convert
python data_converter.py --input-dir ./json --output-dir ./csv --format csv

# Pretty print
python data_converter.py --input data.json --output pretty.json --indent 4

CLI Arguments

ArgumentDescriptionDefault
--inputInput fileRequired
--outputOutput fileRequired
--input-dirInput directory for batch-
--output-dirOutput directory-
--formatOutput formatFrom extension
--flattenFlatten nested dataFalse
--indentIndentation spaces2
--rootXML root elementroot

Conversion Matrix

From/ToJSONCSVXMLYAMLTOML
JSON-YesYesYesYes
CSVYes-YesYesYes
XMLYesYes-YesYes
YAMLYesYesYes-Yes
TOMLYesYesYesYes-

Examples

JSON to CSV (Flat)

converter = DataTypeConverter()

# Input: data.json
# [{"name": "John", "age": 30}, {"name": "Jane", "age": 25}]

converter.convert("data.json", "data.csv")

# Output: data.csv
# name,age
# John,30
# Jane,25

Nested JSON to Flat CSV

# Input: nested.json
# [{"user": {"name": "John", "email": "[email protected]"}, "orders": 5}]

converter.convert("nested.json", "flat.csv", flatten=True)

# Output: flat.csv
# user.name,user.email,orders
# John,[email protected],5

YAML Config to JSON

# Input: config.yaml
# database:
#   host: localhost
#   port: 5432
# debug: true

converter.convert("config.yaml", "config.json")

# Output: config.json
# {"database": {"host": "localhost", "port": 5432}, "debug": true}

XML to JSON

# Input: data.xml
# <users>
#   <user><name>John</name><age>30</age></user>
# </users>

converter.convert("data.xml", "data.json")

# Output: data.json
# {"users": {"user": {"name": "John", "age": "30"}}}

Dependencies

pyyaml>=6.0
toml>=0.10.0
xmltodict>=0.13.0
pandas>=2.0.0

Limitations

  • CSV doesn't support nested data (requires flattening)
  • XML attribute handling is basic
  • TOML doesn't support null values
  • Very deep nesting may cause issues with some formats
  • Array handling varies by format

GitHub リポジトリ

majiayu000/claude-skill-registry
パス: skills/data-type-converter

関連スキル

content-collections

メタ

This skill provides a production-tested setup for Content Collections, a TypeScript-first tool that transforms Markdown/MDX files into type-safe data collections with Zod validation. Use it when building blogs, documentation sites, or content-heavy Vite + React applications to ensure type safety and automatic content validation. It covers everything from Vite plugin configuration and MDX compilation to deployment optimization and schema validation.

スキルを見る

polymarket

メタ

This skill enables developers to build applications with the Polymarket prediction markets platform, including API integration for trading and market data. It also provides real-time data streaming via WebSocket to monitor live trades and market activity. Use it for implementing trading strategies or creating tools that process live market updates.

スキルを見る

hybrid-cloud-networking

メタ

This skill configures secure hybrid cloud networking between on-premises infrastructure and cloud platforms like AWS, Azure, and GCP. Use it when connecting data centers to the cloud, building hybrid architectures, or implementing secure cross-premises connectivity. It supports key capabilities such as VPNs and dedicated connections like AWS Direct Connect for high-performance, reliable setups.

スキルを見る

llamaindex

メタ

LlamaIndex is a data framework for building RAG-powered LLM applications, specializing in document ingestion, indexing, and querying. It provides key features like vector indices, query engines, and agents, and supports over 300 data connectors. Use it for document Q&A, chatbots, and knowledge retrieval when building data-centric applications.

スキルを見る