Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is this a valid JSON response?

G'day gurus,

I'm calling the REST APIs of an enterprise application that shall remain nameless, and they return JSON such as the following:

throw 'allowIllegalResourceCall is false.';
{
  "data": ... loads of valid JSON stuff here ...
}

Is this actually valid JSON? If (as I suspect) it isn't, is there any compelling reason for these kinds of shenanigans?

The response I received from the application vendor is that this is done for security purposes, but I'm struggling to understand how this improves security much, if at all.

Thanks in advance!

Peter

like image 347
Peter Avatar asked May 23 '11 21:05

Peter


2 Answers

According to

http://jsonlint.com/

It is not.

Something like the below is.

{
    "data": "test"
}

Are they expecting you to pull the JSon load out of the message above?

like image 93
Kenoyer130 Avatar answered Sep 28 '22 15:09

Kenoyer130


Its not a JSON format at all. From your question it seems you are working with enterprise systems like JIVE :). I am also facing same issue with JIVE api. This is the problem with their V3 API. Not standard , but following thing worked for me. (I am not sure if you are talking about JIVE or not)

//invalid jason response... https://developers.jivesoftware.com/community/thread/2153  
 jiveResponse = jiveResponse.Replace
 ("throw 'allowIllegalResourceCall is false.';",String.Empty);                  
like image 34
Hitesh Avatar answered Sep 28 '22 16:09

Hitesh