Digging into this a bit deeper, I now understand the exact problem.
The issue is the difference in newlines between sdp_get output and the JSON format.
sdp_get returns the SDP with unix newline characters i.e. \r\n.
However JSON won't accept unix newlines and requires a single line output with literal \r\n instead (i.e. escaped).
So now I'm having to write the SDP into an external file using exec_msg, manipulate it with awk -v RS='\r?\n' -v ORS='\\r\\n' '1' and then bring it back into Kamailio. Not nice and also not yet working correctly yet.
If there was a function within the JANSSON module to take a multi-line input (like the SDP) and convert it into a single line with literal \r\n characters ready for posting in a JSON message then that would make life much easier.