<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Struct - 标签 - 研发日志 · R&amp;D Log</title><link>https://rd163.visword.com/tags/struct/</link><description>Struct - 标签 - 研发日志 · R&amp;D Log</description><generator>Hugo -- gohugo.io</generator><language>zh-CN</language><managingEditor>whutluohui@gmail.com (小智晖)</managingEditor><webMaster>whutluohui@gmail.com (小智晖)</webMaster><copyright>本作品采用知识共享署名-非商业性使用 4.0 国际许可协议进行许可。</copyright><lastBuildDate>Sun, 12 Jan 2025 00:00:00 +0800</lastBuildDate><atom:link href="https://rd163.visword.com/tags/struct/" rel="self" type="application/rss+xml"/><item><title>JSON 转 Go 结构体的几种方案</title><link>https://rd163.visword.com/posts/golang-json-to-struct/</link><pubDate>Sun, 12 Jan 2025 00:00:00 +0800</pubDate><author><name>小智晖</name></author><guid>https://rd163.visword.com/posts/golang-json-to-struct/</guid><description><![CDATA[<p>在对接 RESTful API 或解析配置文件时，把一段 JSON 示例手工逐字段翻译成 Go 的 <code>struct</code> 是一件繁琐且容易出错的事。好在社区已经提供了不少自动化方案，从浏览器里的在线工具，到本地命令行，再到 IDE 内建的转换功能，基本可以覆盖大多数场景。本文梳理几种常用方案，并补充 <code>encoding/json</code> 的 struct tag 关键用法，帮助你在不同情境下做出选择。</p>]]></description></item></channel></rss>