Paw REST Client - generate objects from JSON response

Are there any plans to include PAW to generate code from a JSON response? Or check out the javascript API for this? I would like to generate obj-c or swift classes based on the response.

+4
source share
1 answer

It is true that the code generator does not do this, but a JavaScript API exists, you can see here an Overview of what is possible and here is a complete API Reference . Here's also a quick tutorial on how to create a code generator in Paw .

Here is a snippet of how to get JSON from the last HTTP response for this request:

var MyCodeGenerator = function() {
    this.generate = function(context) {
        var responseBody = context.getCurrentRequest().getLastExchange().responseBody;
        var responseObject = JSON.parse(responseBody); // JSON object
        return JSON.stringify(responseObject); // just an example
    };
}

MyCodeGenerator.identifier = "com.mycompany.MyCodeGenerator";

MyCodeGenerator.title = "My Code Generator";
0
source

All Articles