unmarshal(动词):在计算机领域常指反序列化——把某种已编码/序列化的数据(如 JSON、XML、二进制)解析并转换回程序中的数据结构或对象。
也可泛指把“已整理/已编排的东西”解组、拆散(较少见)。
/ʌnˈmɑːrʃəl/(英式常见) ,/ʌnˈmɑrʃəl/(美式常见)
The program unmarshals the JSON into a struct.
程序把 JSON 反序列化为一个结构体。
After receiving the message, the server unmarshalled the binary payload, validated the fields, and stored the result in the database.
服务器收到消息后,对二进制载荷进行反序列化,校验各字段,并将结果写入数据库。
由 **un-**(表示“反向、取消”)+ marshal(原义与“整理、编排、列队”相关)构成,字面意思是“取消编排、把队列拆开”。在现代技术语境中引申为把“已编排成可传输格式的数据”解析回内部结构,即“反序列化”。
encoding/json 时会出现 Unmarshal(如 json.Unmarshal)。encoding/json、encoding/xml)在讲解数据转换接口时频繁使用 Unmarshal。