我想对 sendgrid 模板接收到的对象进行“字符串化”。换句话说,我如何将未知的结构化对象与 sendgrid 模板一起使用。
例子:
我的对象:
{"test": {"foo": { "bar": {"foo2": "bar2"}}}
我的发送网格模板:
... what is inside the test object: {{ test }}
结果是:
... 测试对象里面是什么:[object Object]
但是我想要这样的东西:
... 测试对象里面是什么:{"foo": { "bar": {"foo2": "bar2"}}}
有可能吗?
测试数据:
{"test": {"foo": { "bar": {"foo2": "bar2"}}}}
HTML:
{{test.foo.bar.foo2}}
渲染:
bar2