Linkedin API Caption with Carriage Return
I'm using a carriage return on Linkedin Caption
to share the post via Linkedin Share article API
. But while sharing through API it returns an error like
"Error parsing request body to JSON Illegal unquoted character ((CTRL-CHAR, code 10)): has to be escaped using a backslash to be included in string value\n at [Source: (com.linkedin.data.ByteString$ByteArrayVectorInputStream)"
Is there any way to resolve this issue and pass a carriage return in the caption. Please help.
I have tried to replace the carriage return using "\n" since it shows like escape using backslash but it's not working for me.
$msg = 'test1 test2
test3';
$msg = preg_replace("/[^A-Za-z ]/","\n",$msg);
I have tried the above but again I got the same error response from Linkedin API.
The expecting result to share a post with a caption like below,
"test1 test2
test3"
But it won't get a post to the user account instead it gives an error like
"Error parsing request body to JSON Illegal unquoted character ((CTRL-CHAR, code 10)): has to be escaped using a backslash to be included in string value\n at [Source: (com.linkedin.data.ByteString$ByteArrayVectorInputStream)"