【发布时间】:2019-09-26 00:49:48
【问题描述】:
我在我的 React 应用程序中使用以下方法将我的 Object 转换为字符串。一切正常,但我想在屏幕上输出结果,而输出周围没有""。
renderConfigInfoCellRow = configInfoKey => {
const { lconfigInfo } = this.props;
return (
<tr key={configInfoKey}>
<td className="pt-3 text-muted font-weight-bold w-25">{configInfoKey}</td>
{(typeof lconfigInfo.sql[configInfoKey] === 'string' && (
<td className="pt-3">{JSON.stringify(lconfigInfo.sql[configInfoKey])}</td>
)}
</tr>
);
};
我在这里使用它:
<tbody>
{Object.keys(lconfigInfo.sql).map(configInfoKey =>
this.renderConfigInfoCellRow(configInfoKey)
)}
</tbody>
知道如何删除"output" 周围的"" 吗?或者,如果它们是 JSON.Stringify 的替代品。谢谢!!
【问题讨论】:
-
能否请您提供对象输出示例?而实际结果是什么
标签: javascript json reactjs stringify