How to decode a json which having multi line value for a key

I have been trying to decode a JSON response from a third party server. The issue I can not decode the JSON because one of the JSON key's value is multi-line.

What I have done so far:-

$jsonobj = '{
    "requestId":"123",
    "errorCode": "322231231",
    "errorMessage": "lorem ipsum1
            lorem ipsum2
            lorem ipsum3
        "
}';

print_r(json_decode($jsonobj, true));

As the JSON response comes from a third party how to handle this situation?



Read more here: https://stackoverflow.com/questions/65718395/how-to-decode-a-json-which-having-multi-line-value-for-a-key

Content Attribution

This content was originally published by MjM at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: