for this, there are following possible solutions out of many available..
Use Line Terminator Escape sequence
Use '\' (backslash) at the end of each line which will escape the new line for that particular line. Details
"""
{
"name":"codingeek",\
"type":"blog"\
}
"""
Use the 'replaceAll' method on String object
Use replaceAll("\n", " ")
method on the string object to replace all newline characters with the replacement of your choice.
"""
{
"name":"codingeek",
"type":"blog"
}
""".replaceAll("\n", " ");