Home  >  Q&A  >  body text

java - 解析json数据如何自动换行

中间的一大段我应该怎么让他分成几行呢?返回的是json数据,是要讲,替换成什么特殊字符么??

伊谢尔伦伊谢尔伦2713 days ago1226

reply all(9)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-04-17 17:40:58

    I obtained the string .replace("The escape character you set yourself or specified for newline", "nt");

    reply
    0
  • 迷茫

    迷茫2017-04-17 17:40:58

    \r

    reply
    0
  • 怪我咯

    怪我咯2017-04-17 17:40:58

    json is just data, the front-end display is controlled by you
    html automatic line wrapping just needs to be surrounded by p!

    reply
    0
  • 迷茫

    迷茫2017-04-17 17:40:58

    This part really needs to be handled by yourself, unless the json data returned by the backend provides you with a list of the fields you need, which is very convenient to control.

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 17:40:58

    Multiply the width of each Chinese character by the number, and add a line break when it is larger than the screen width. The width of Chinese characters can be calculated based on the value of the textsize attribute.

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 17:40:58

    The json format does not have line breaks. The string enclosed by "" needs to be replaced with a line break escape character. When a general json tool converts a string to json, it will automatically convert the line break character into an escaped line break character, such as line feed and carriage return. The 2 special characters 0x0d 0x0a are automatically converted into the 4-character escape character rn. Generally, manual conversion is not required

    reply
    0
  • 黄舟

    黄舟2017-04-17 17:40:58

    This is the escape agreed by the server and client, such as the agreed line break---"&br". . .

    reply
    0
  • 阿神

    阿神2017-04-17 17:40:58

    What you screenshot is equivalent to a string of HTML strings. Just escape special characters such as quotation marks and tabs and store it as data in JSON format. . Then when you want to use it, just get this string of data from JSON and output it in an HTML file.

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-17 17:40:58

    Your json data format problem, please communicate with the backend about this aspect

    reply
    0
  • Cancelreply