Seperating json part of a received message from header

Hello,

I am using a third party api to receive data and the response contains header information. I am not sure how to parse the json part of the message in the response event. I have no control of the message formatting since its a third party.

Here is a sample of the returned message. I just need the json string at the end.

HTTP/1.1 200 OK Date: Sat, 06 Feb 2016 21:17:00 GMT Server: Apache X-Powered-By: PHP/5.4.38 Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Vary: Accept-Encoding,Cookie Connection: close Content-Type: application/json {“success”:true,“result”:[{“driversno”:"",“drivers_tks_driverid”:“9999”,“drivers_tks_firstname”:“Test”,“drivers_tks_lastname”:“Test”,“drivers_tks_employeenumber”:“9999”,“drivers_tks_dlnumber”:“9999”,“drivers_tks_pin”:“9999”,“assigned_user_id”:“19x13”,“createdtime”:“2016-01-22 14:04:27”,“modifiedtime”:“2016-01-22 14:04:55”,“id”:“38x168”},

For the response I am using json.decode(event.response) but it reads the message as a null.

Thanks for any suggestions

Hi,

Does this service provide an endpoint that only returns the JSON as the body? It looks like you’re getting a raw response.

I would have to look at the endpoint to really be able help.

Cheers.

Hi develephant,

Thanks for the response. Actually they do provide an endpoint with just JSON response. I just discovered this so problem solved.

Cheers

Hi,

Does this service provide an endpoint that only returns the JSON as the body? It looks like you’re getting a raw response.

I would have to look at the endpoint to really be able help.

Cheers.

Hi develephant,

Thanks for the response. Actually they do provide an endpoint with just JSON response. I just discovered this so problem solved.

Cheers