cancel
Showing results for 
Search instead for 
Did you mean: 

How to deal with response that is the true JSON?

DaisyTam
New Contributor

I am trying to use REST GET snap to retrieve data from jive. However, they add a line “throw ‘allowillegalresourcecall is false.’;” in every response and therefore make the response not true JSON. REST GET snap is failing because of this.

I am looking for your expert help. Is there a way I can intercept the response and remove the first line before handing it back to the snap to process?

3 REPLIES 3

dmiller
Admin Admin
Admin

I haven’t used Jive, but this seems related to your query: https://community.jivesoftware.com/community/developer/blog/2015/06/29/throw-allowillegalresourcecal...
(Obviously the opposite value, but the examples provided may help)


Diane Miller
Community Manager

dwhite
Employee
Employee

Hello,

If you haven’t found a solution yet, please try this.

Within the REST Get snap there is a setting called “response entity type” you can switch this from default which is like an auto mode.

33 AM

TEXT mode should give you the raw text of the response, and exempt it from the parsing giving you just a string of whatever your response is.

BINARY mode will return you a binary base64 string

For your problem I suggest using the TEXT option to get a raw string and then use SnapLogic expression language string manipulation functions to remove the line invalidating your json.

Once you have removed the invalid content, you can use the eval function to parse the json string into workable objects.

tstack
Former Employee

Note: There is a JSON.parse() method that would be safer to use than eval.