How do I bring back my own jSON via post process?

I can’t seem to change anything.

I want to process my result set and then create my own JSON response. No matter what I do it doesn’t seem to affect the results.

For instance;

//****************** Post-processing script on the stored procedure ******************

var_dump(event.response); // outputs to file in storage/log of dreamfactory install directory

var lodash = require(“lodash.min.js”);

return [“stuff”];

This doesn’t return “stuff” just the list of original records it is supposed to send. How do I intercept the result and then process it and return the new JSON.


OK - I had done a post with a get response. So by changing it to post process the POST, I am finally seeing the records come back. Now the weird part. If I put : return -99 in my script it will return it. However, if I try to return anything else, is seems to bypass my logic and always return the original result.

Anyone have an example of taking a response, perform logic with it, and send on a new JSON?


ok. the sample code says: event.response.resource

the sample video says: event.response.content.resource

Which is it?

Hi @jimijon,

if envent script use:

var myValue = "teste";
\\event.response.content.[your param] = [your value] include value in your response
event.response.content.myValue = myValue;
event.response.content_changed = true; \\ save changed

or service script use only
return myValue

Doc in :

I hope I helped you :slight_smile:

Not really. I am trying to loop through the response and nothing seems to work:

lodash._.each (event.response.content.resource, function( record ) {
    storeId == 101 ;
    return false;
lodash._.each (event.response.content, function( record ) {
    storeId == 102 ;
    return false;
lodash._.each (event.response.record, function( record ) {
    storeId == 103 ;
    return false;
lodash._.each (event.response.resource, function( record ) {
    storeId == 1034;
    return false;
lodash._.each (event.response.content.record, function( record ) {
    storeId == 103 ;
    return false;

None of the above set the storeId.

this code is it correct syntax, but
maybe your problem the syntax in internal block
“==” It is a comparison that returns a boolean, not an assignment for that you should use only one equal. And I was not accessing the record object.


lodash._.each (event.response.content.resource, function( record ) {
    record.storeId = 101;

I’m sorry, for my english.
I’m using translate of google :joy:

1 Like