How to deal with response that is the true JSON?

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?

I haven’t used Jive, but this seems related to your query:
(Obviously the opposite value, but the examples provided may help)


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.

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.

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

1 Like