首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >将json数据添加到json列就是添加转义字符

将json数据添加到json列就是添加转义字符
EN

Stack Overflow用户
提问于 2018-11-19 13:00:01
回答 1查看 410关注 0票数 0

我正在使用postgres数据库,我有一个名为names的表,其中有一个名为'info‘的列,其类型为json。我正在添加

代码语言:javascript
复制
{ "info": "security" , description : "Sednit update: Analysis of Zebrocy: The Sednit group \u2013 also known as APT28, Fancy Bear, Sofacy or STRONTIUM \u2013 is a group of attackers operating since 2004, if not earlier, and whose main objective is to steal confidential information from specific targets.\n\nToward the end of 2015, we started seeing a new component deployed by the group; a downloader for the main Sednit backdoor, Xagent. Kaspersky mentioned this component for the first time in 2017 in their APT trend report and recently wrote an article where they quickly described it under the name Zebrocy.\n\nThis new component is a family of malware, comprising downloaders and backdoors written in Delphi and AutoIt. These components play the same role in the Sednit ecosystem as Seduploader; that of first-stage malware."}

在这里,我使用了node js,将sequelize作为orm。当我把它保存在表中的时候。我看到"\n“代表"\n”," \u“代表\u。是否有人可以帮助我在保存到表中时避免转义字符。

EN

回答 1

Stack Overflow用户

发布于 2018-11-19 13:30:49

我看到\n代表\n,而\u代表\u。

在您的json描述中的类型是string,所以它会将新行/ enter 转换为\n,这是默认行为,否则当您再次尝试获取数据时,您将不会得到新行/enter。

\u用于unicode,您可能会保存一些smily特殊字符,以便将其转换为此类字符串。

所以没有bug,这就是它的工作方式。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53368565

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档