json - 在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"}]}
解决方案
HTML 是正在呈现的内容。如果您想要 HTML 换行符,则需要使用 HTML 标记,即<br>
.
如果您使用的是框架(例如,Angular 或 Ionic),您可能需要确保您的 HTML 标记没有被转义。
推荐阅读
- javascript - Firebase - 无法同时对数据进行排序和过滤
- html - 如何在 Django 中使用 CSS 块内容组织 HTML
- android - FirebaseRecyclerAdapter 类中的构造函数 FirebaseRecyclerAdapter 出错
- c# - 将大量人口移动到固定位置的问题
- javascript - Wordpress 图片库无法正常工作
- java - 如何避免调用内部方法结构的级联,同时为特定方法进行 Junit 测试用例和模拟
- python - open cv 中的拉普拉斯算子和索贝尔函数无法正常工作
- javascript - 状态未定义
- spring - 如何将地图字段添加到数据库?
- apache-spark - 如何比较两个表并用其他表中的值替换空值