解码 YAML 序列化对象

发布于 2024-09-14 20:01:51 字数 156 浏览 0 评论 0原文

我已经在 YAML 中序列化了一个对象并将其发送给远程工作人员。

工作人员没有对象定义,因此我得到一个 YAML::Object。

我如何访问其中的字段?

文本字段似乎是经过 Base64 编码的,我该如何解码? (不,decode64 不起作用)。

I have serialized an object in YAML and send it to a remote worker.

The worker doesent have the object definition so i get a YAML::Object.

How can i access the field inside it?

A text field seems like that base64 encoded, how can i decode that? (no, decode64 not works).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

一绘本一梦想 2024-09-21 20:01:51

您可以将对象作为“双方已知”的东西(如开放结构或散列)传递或向客户端提供描述。

如果有一种序列化格式也能序列化类及其方法,那将会很有趣……我必须考虑一下这个……

you can pass the object as something "known between both sides" (like an openstruct or hash) or give the description to the client.

It would be interesting to have a serialization format that also serialized the class and its methods...I'll have to think about that one...

倚栏听风 2024-09-21 20:01:51

尝试 c["bar"]

您还可以使用 c.keys 查看所有提供的键

try c["bar"]

you can also see all the provided keys using c.keys

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文