JSONtoRustStruct のクイックスタート
最初に成功させるために必要なすべて:何を入力し、どのオプションが重要で、結果をどう読むか。
使い方
- ツールを開き、左の入力欄にデータを貼り付けます。
- タスクに本当に必要なオプションだけを設定します。ほとんどの場合、既定値で正しく動作します。
- 右の出力欄で結果を確認します。入力に応じてリアルタイムに更新されます。
- 「コピー」で結果を取得するか、「ダウンロード」でファイルとして保存します。
例
Emits serde rename attributes so the Rust field names can stay idiomatic.
入力
{"id":42,"title":"Hello","tags":["a","b"],"active":true}
出力 — 検索結果
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Root {
#[serde(rename = "id")]
pub id: i64,
#[serde(rename = "title")]
pub title: String,
#[serde(rename = "tags")]
pub tags: Vec<String>,
#[serde(rename = "active")]
pub active: bool,
}
実行
説明
Generate a serde-derived Rust struct with rename attributes from a JSON sample.
関連ツール
CSV to JSON 変換Turn CSV (or any delimited file) into a JSON array.YAML to JSON 変換Parse YAML configuration into JSON.HTML to Markdown 変換Convert HTML fragments into Markdown.JSON to TOML 変換Convert JSON config into TOML format.Markdown to HTML 変換Render Markdown to clean HTML.Delimiter 変換Switch CSV between comma, tab, semicolon and pipe.