JSON to Rust Struct: guía de inicio rápido
Todo lo necesario para un primer uso correcto: qué pegar, qué opción importa de verdad y cómo leer el resultado.
Cómo usar
- Abre la herramienta y pega tu entrada en el panel izquierdo.
- Ajusta solo las opciones que tu tarea necesita de verdad; los valores por defecto sirven para la mayoría de los casos.
- Lee el resultado en el panel derecho; se actualiza mientras escribes.
- Usa Copiar para llevarte el resultado o Descargar para guardarlo como archivo.
Ejemplos
Emits serde rename attributes so the Rust field names can stay idiomatic.
Entrada
{"id":42,"title":"Hello","tags":["a","b"],"active":true}
Salida — Resultados
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,
}
Ejecutar
Descripción
Generate a serde-derived Rust struct with rename attributes from a JSON sample.
JSON to Rust Struct → · Cómo usar → · Herramientas de conversión de datos →
Herramientas relacionadas
Conversor de CSV to JSONTurn CSV (or any delimited file) into a JSON array.Conversor de YAML to JSONParse YAML configuration into JSON.Conversor de HTML to MarkdownConvert HTML fragments into Markdown.Conversor de JSON to TOMLConvert JSON config into TOML format.Conversor de Markdown to HTMLRender Markdown to clean HTML.Conversor de DelimiterSwitch CSV between comma, tab, semicolon and pipe.