首页 > 解决方案 > 在json中换行的正确方法

问题描述

我无法\r\n在此屏幕上使用以下有效负载进行换行。

我正在尝试找出正确的 json 播放负载,我应该将其发送到前端,以便将其解释为换行符。

在此处输入图像描述

   {"allEvents": [{"data": [{"PSCPowerCableFailure": {"error_name": "patient_cart_running_on_battrey", "steps": {"1": {"step_body": {"step_link": {"type": "image", "url": "../../assets/patient-cart-running-on-battery_step_1.png"}}, "step_body_header": "Reconnect power cable to power outlet.", "step_body_text": "Confirm error is cleared on Vision Cart touchscreen. \r\nSwipe to the next troubleshooting screen if message does not clear.", "step_title": "Patient Cart Running on Battery"}, "2": {"step_body": {"step_link": {"type": "image", "url": "../../assets/patient-cart-running-on-battery_step_2.png"}}, "step_body_header": "Check circuit breaker on back of Patient Cart. Ensure that it is set to the ON (I) position.", "step_body_text": "Swipe to the next troubleshooting step if message does not clear.", "step_title": "Patient Cart Running on Battery"}, "3": {"step_body": {"step_link": {"type": "image", "url": "../../assets/exclamation-blue-circle-icon.png"}}, "step_body_header": "Call dVSTAT at 1.800.XXX.XXXX for additional assistance if required. \r\n  A representative can guide you through additional troubleshooting procedures.", "step_body_text": "System Information:\r\n  System Name: XXXXXX\r\n  Software Version: P8d", "step_title": "Patient Cart Running on Battery"}}}, "arm_number": null, "error_display_name": "Patient Cart Running on Battrey", "error_id": "PSCPowerCableFailure", "error_name": "patient_cart_running_on_battrey", "priority": 0, "show_default": "false"}], "error_content_id": "PSCPowerCableFailure", "type": "error_occurred"}]}

标签: jsonangularionic-framework

解决方案


HTML 是正在呈现的内容。如果您想要 HTML 换行符,则需要使用 HTML 标记,即<br>.

如果您使用的是框架(例如,Angular 或 Ionic),您可能需要确保您的 HTML 标记没有被转义。


推荐阅读