问题
I want the watson conversation to give an output like:
I can solve the problems for the following products.
1 Air Conditioner
2 Refrigerator
3 Washing Machine
I am trying the following in JSON. But I am getting all the text cramped together.
{ "output": { "text": "I can solve the problems for the following products.\n\n1\tAir Conditioner\n2\tRefrigerator\n3\tWashing Machine" } }
I have also tried \n and \t which is also unsuccessful. Is there any way to get the text properly spaced in the JSON text tag. (I used the conversation tool to everything)
回答1:
I found the answer!!
add
"br" tags in the simple format of JSON. It is not reflected on the test chat, the change is only reflected on deploying it in an app
回答2:
Try this:
{
"output": {
"text": ["I can solve the problems for the following products.",
"1\tAir Conditioner", "2\tRefrigerator", "3\tWashing Machine"
]
}
}
As per documentation:
To specify more than one statement that you want to display on separate lines, define the output as a JSON array.
The first sentence is displayed on one line, and the second sentence is displayed as a new line below it.
Source: https://console.bluemix.net/docs/services/conversation/dialog-build.html#responses
来源:https://stackoverflow.com/questions/40023329/adding-newline-and-spacing-in-watson-conversation-output-json