Data Transform
CSV, JSON, XML, YAML parsing, generation, and pipeline transformations.
16 modules
| Module | Description |
|---|---|
| CSVファイル読み込み | CSVファイルを読み込みオブジェクト配列に変換する |
| CSVファイル書き込み | オブジェクト配列をCSVファイルに書き込む |
| JSONパース | JSON文字列をオブジェクトに変換する |
| JSON文字列化 | オブジェクトをJSON文字列に変換する |
| JSONからCSV変換 | JSONデータまたはファイルをCSV形式に変換する |
| データパイプライン | 複数のデータ変換を一度にチェーンする |
| テキストテンプレート | 変数を使用してテキストテンプレートを埋める |
| XML生成 | オブジェクトや配列からXML文字列を生成 |
| XML解析 | XML文字列をオブジェクトに解析 |
| YAML生成 | オブジェクトや配列からYAML文字列を生成 |
| YAML解析 | YAML文字列をオブジェクトに解析 |
| オブジェクトキー | オブジェクトからすべてのキーを取得 |
| オブジェクトマージ | 複数のオブジェクトを1つにマージ |
| オブジェクト除外 | オブジェクトから特定のキーを除外 |
| オブジェクト選択 | オブジェクトから特定のキーを選択 |
| オブジェクト値 | オブジェクトからすべての値を取得 |
Modules
CSVファイル読み込み
data.csv.read
CSVファイルを読み込みオブジェクト配列に変換する
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
path | string | Yes | - | Path to the file |
delimiter | select (,, ;, , ` | , `) | No | , |
encoding | select (utf-8, ascii, latin-1, utf-16, gbk, big5) | No | utf-8 | Character encoding for the file |
skip_header | boolean | No | False | Skip first row (header) |
Output:
| Field | Type | Description |
|---|---|---|
status | string | 操作ステータス |
data | array | 行オブジェクトの配列 |
rows | number | 行数 |
columns | array | カラム名の配列 |
Example: Example
file_path: data/users.csv
delimiter: ,
encoding: utf-8CSVファイル書き込み
data.csv.write
オブジェクト配列をCSVファイルに書き込む
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
path | string | Yes | - | Path to the file |
data | array | Yes | - | Array of data items to process |
delimiter | select (,, ;, , ` | , `) | No | , |
encoding | select (utf-8, ascii, latin-1, utf-16, gbk, big5) | No | utf-8 | Character encoding for the file |
Output:
| Field | Type | Description |
|---|---|---|
status | string | 操作ステータス |
file_path | string | ファイルパス |
rows_written | number | 書き込まれた行数 |
Example: Example
file_path: output/results.csv
data: [{"name": "John", "score": 95}, {"name": "Jane", "score": 87}]JSONパース
data.json.parse
JSON文字列をオブジェクトに変換する
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
json_string | string | Yes | - | JSON string to parse into an object or array |
Output:
| Field | Type | Description |
|---|---|---|
status | string | 操作ステータス |
data | object | パースされたデータ |
Example: Example
json_string: {"name": "John", "age": 30}JSON文字列化
data.json.stringify
オブジェクトをJSON文字列に変換する
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
data | object | Yes | - | Data object to process |
pretty | boolean | No | False | Format with indentation |
indent | number | No | 2 | Indentation spaces (if pretty=true) |
Output:
| Field | Type | Description |
|---|---|---|
status | string | 操作ステータス |
json | string | JSON文字列 |
Example: Example
data: {"name": "John", "age": 30}
pretty: trueJSONからCSV変換
data.json_to_csv
JSONデータまたはファイルをCSV形式に変換する
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
input_data | any | Yes | - | JSON data (array of objects) or path to JSON file |
output_path | string | No | /tmp/output.csv | Path where the output file will be saved |
delimiter | select (,, ;, , ` | , `) | No | , |
include_header | boolean | No | True | Include column headers in first row |
flatten_nested | boolean | No | True | Flatten nested objects using dot notation (e.g., address.city) |
columns | array | No | [] | Specific columns to include (empty = all columns) |
Output:
| Field | Type | Description |
|---|---|---|
output_path | string | 生成されたCSVファイルのパス |
row_count | number | 書き込まれた行数 |
column_count | number | カラム数 |
columns | array | カラム名の配列 |
Example: Convert JSON array to CSV
input_data: [{"name": "Alice", "age": 30}, {"name": "Bob", "age": 25}]
output_path: /tmp/users.csvExample: Convert JSON file
input_data: /path/to/data.json
output_path: /path/to/output.csvデータパイプライン
data.pipeline
複数のデータ変換を一度にチェーンする
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
input | any | Yes | - | 変換する入力データ(配列またはオブジェクト) |
steps | array | Yes | - | 変換する入力データ(配列またはオブジェクト) |
Output:
| Field | Type | Description |
|---|---|---|
result | any | 適用する変換ステップの配列 |
original_count | integer | 変換されたデータ |
result_count | integer | 変換されたデータ |
steps_applied | integer | 変換後のアイテム数 |
Example: Example
input: ${input.users}
steps: [{"filter": {"field": "active", "condition": "eq", "value": true}}, {"sort": {"field": "name", "order": "asc"}}]Example: Example
input: ${input.records}
steps: [{"map": {"extract": "id"}}, {"limit": 10}]Example: Example
input: ${input.data}
steps: [{"filter": {"field": "status", "condition": "eq", "value": "completed"}}, {"pick": ["id", "name", "timestamp"]}, {"sort": {"field": "timestamp", "order": "desc"}}, {"skip": 5}, {"limit": 20}]テキストテンプレート
data.text.template
変数を使用してテキストテンプレートを埋める
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
template | string | Yes | - | Text template with {variable} placeholders |
variables | object | Yes | - | Object with variable values |
Output:
| Field | Type | Description |
|---|---|---|
status | string | 操作ステータス |
result | string | テンプレート結果 |
Example: Example
template: Hello {name}, you scored {score} points!
variables: {"name": "Alice", "score": 95}XML生成
data.xml.generate
オブジェクトや配列からXML文字列を生成
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
data | object | Yes | - | XMLに変換するデータ |
root_tag | string | No | root | ルート要素のタグ名 |
pretty | boolean | No | True | XML出力を整形して表示 |
encoding | string | No | utf-8 | XML出力の文字エンコーディング |
declaration | boolean | No | True | XML宣言ヘッダーを含める |
Output:
| Field | Type | Description |
|---|---|---|
xml | string | 生成されたXML文字列 |
Example: Example
data: {"user": {"@attributes": {"id": "1"}, "name": "John", "age": "30"}}
root_tag: users
pretty: trueXML解析
data.xml.parse
XML文字列をオブジェクトに解析
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
content | string | No | - | 解析するXML文字列 |
file_path | string | No | - | 解析するXMLファイルのパス |
preserve_attributes | boolean | No | True | 解析された出力でXML属性を保持 |
Output:
| Field | Type | Description |
|---|---|---|
result | object | オブジェクトとして解析されたXML |
root_tag | string | ルート要素のタグ名 |
Example: Example
content: <users><user id="1"><name>John</name></user></users>
preserve_attributes: trueYAML生成
data.yaml.generate
オブジェクトや配列からYAML文字列を生成
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
data | any | Yes | - | YAMLに変換するデータ |
default_flow_style | boolean | No | False | ネストされた構造にフロースタイルを使用 |
sort_keys | boolean | No | False | キーをアルファベット順にソート |
indent | number | No | 2 | インデントのスペース数 |
allow_unicode | boolean | No | True | 出力にユニコード文字を許可 |
Output:
| Field | Type | Description |
|---|---|---|
yaml | string | 生成されたYAML文字列 |
Example: Example
data: {"name": "John", "age": 30, "cities": ["NYC", "LA"]}
sort_keys: false
indent: 2YAML解析
data.yaml.parse
YAML文字列をオブジェクトに解析
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
content | string | No | - | 解析するYAML文字列 |
file_path | string | No | - | 解析するYAMLファイルのパス |
multi_document | boolean | No | False | マルチドキュメントYAMLを解析(---で区切る) |
Output:
| Field | Type | Description |
|---|---|---|
result | any | オブジェクトまたは配列として解析されたYAML |
type | string | 解析された結果のタイプ |
Example: Example
content: name: John
age: 30
cities:
- NYC
- LA
multi_document: falseExample: Example
content: ---
name: John
---
name: Jane
multi_document: trueオブジェクトキー
object.keys
オブジェクトからすべてのキーを取得
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
object | object | Yes | - | Input object/dictionary |
Output:
| Field | Type | Description |
|---|---|---|
keys | array | オブジェクトキーのリスト |
count | number | オブジェクトキーのリスト |
Example: Get object keys
object: {"name": "John", "age": 30, "city": "NYC"}オブジェクトマージ
object.merge
複数のオブジェクトを1つにマージ
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
objects | array | Yes | - | Array of objects to process |
Output:
| Field | Type | Description |
|---|---|---|
result | object | マージされたオブジェクト |
Example: Merge user data
objects: [{"name": "John", "age": 30}, {"city": "NYC", "country": "USA"}, {"job": "Engineer"}]オブジェクト除外
object.omit
オブジェクトから特定のキーを除外
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
object | object | Yes | - | Input object/dictionary |
keys | array | Yes | - | Keys to pick or omit |
Output:
| Field | Type | Description |
|---|---|---|
result | object | 除外されたキーを含まないオブジェクト |
Example: Omit sensitive fields
object: {"name": "John", "age": 30, "password": "secret", "ssn": "123-45-6789"}
keys: ["password", "ssn"]オブジェクト選択
object.pick
オブジェクトから特定のキーを選択
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
object | object | Yes | - | Input object/dictionary |
keys | array | Yes | - | Keys to pick or omit |
Output:
| Field | Type | Description |
|---|---|---|
result | object | 選択されたキーのみを含むオブジェクト |
Example: Pick user fields
object: {"name": "John", "age": 30, "email": "john@example.com", "password": "secret"}
keys: ["name", "email"]オブジェクト値
object.values
オブジェクトからすべての値を取得
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
object | object | Yes | - | Input object/dictionary |
Output:
| Field | Type | Description |
|---|---|---|
values | array | オブジェクト値のリスト |
count | number | オブジェクト値のリスト |
Example: Get object values
object: {"name": "John", "age": 30, "city": "NYC"}