如何连接一个字符串和一个对象一起形成一个有效载荷
我需要在需要整理一组字符串和一个对象的地方。 哪种方法正在尝试不同的方式但无法做到,请帮助我。 例子- ABC xyz 后空间 { “你好世界” }
I have requirement where I need to put together a set of string and a object.
Which am trying different ways but unable to do so please help me.
example-
abc
xyz
back space
{
"hello":"world"
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于它们是不兼容的类型,因此无法将对象和字符串连接在一起。但是,您可以将对象“打印”到字符串,然后将其连接。
示例:
输出(类型字符串的输出):
{雇员= sara,类别= {id =雇员01,name = sara}} qu sara world bacf message
An object and a string can not be concatenated together since they are of incompatible types. However you can "print" the object to a string, and then concatenate it.
Example:
Output (of type string):
{employee=sara, categories={id=employee01, name=sara}} QU sara world BACF MESSAGE