Paw REST Client - generate objects from JSON response

Are there plans for enabling PAW to generate code from the JSON response? Or exponse a javascript API to do that? I would like to generate obj-c or swift classes based on the response.

-------------Problems Reply------------

It's true that no code generator does that, but the JavaScript API exists, you can see here the Overview of what's possible and here's the full API Reference. Here's also a quick tutorial on how to make a code generator in Paw.

Here's a snippet on how to get JSON from the latest HTTP response of a given 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";

Category:paw app Views:2 Time:2019-02-08
Tags: paw app

Related post

  • Generating complex treelike JSON responses 2011-12-21

    I have some Java code that will print out JSON from a Servlet: JSONArray arrayObj = new JSONArray(); arrayObj.put("MCA"); arrayObj.put("Amit Kumar"); arrayObj.put("19-12-1986"); arrayObj.put(24); arrayObj.put("Scored"); arrayObj.put(new Double(66.67)

  • Slow requests PAW REST client trial 2014-12-11

    I am evaluating the PAW REST client trial and get extremely slow response time. Same request with browser take about 150ms and 5-6 seconds with PAW. Is that normal or have I missed something?

  • i have obtained the dictionary from json response and now i want to add this dictionary to my existing plist 2009-11-27

    i have obtained a jason response and it is further stored in a dictionary now i want to add this dictionary t my plist ,so that the plist can take values against entries from json response .how should i do it . --------------Solutions------------- Tr

  • EJB 3.1 Pattern for generating objects from a template 2011-08-11

    I am searching for a design pattern to generate objects from a template object. In my game i have different kind of items which will be generated out of a template object. Currently i solved it by inheritance where each template entity implements the

  • Pulling multiple values from JSON response using RegEx Extractor 2011-11-14

    I'm testing a web service that returns JSON responses and I'd like to pull multiple values from the response. A typical response would contain multiple values in a list. For example: { "name":"@favorites", "description":"Collection of my favorite pla

  • How to remove d: from json response through c#? 2013-03-22

    I am consuming asmx web service from Visual studio c#. Sample code WebRequest request = WebRequest.Create(WholeURL); request.ContentType = "application/json; charset=utf-8"; request.Method = "POST"; request.ContentLength = postData.Length; using (Str

  • Android create a list with different objects from JSON (with GSON) 2015-01-26

    I want to create a list with different JSON objects. From my JSON URL I get an array with different types of objects like: [ { "type":0, "cityName":"Berlin", "location":"Germany" }, { "type":1, "weather":"Sun", "degree":10 } ] For the different types

  • Any Method to remove comment characters from JSON response in XCode? 2010-01-28

    I am new to JSON. Are there any methods in JSON parser to remove the comment characters from a response. Eg. //{"response":"success"....... its SBJson for iPhone. from --------------Solutions------------- The J

  • Creating Dynamic variables from json response 2010-12-25

    My JSON response looks like this : {"sample":[{"id":"2","name":"branch name"},{"id":"3","name":"branch name 2"}]} My function looks like this : function getJSONObjects(){ $.getJSON("http://localhost/api/branches", function(data){ $.each(data.sample,

  • How to POST request to Google Shortener API with Google API Java Client and parse a JSON response? 2011-01-18

    I want to use the Google Shortener API. I want to use the google api java client library to post a request and parse the JSON response. Next, I post the code I have tried: import; import net.sf.json.JSONObject; import

  • How can I create Dictionary Type of Object from JSON type of string 2011-02-08

    I am looking to create a dictionary type of object from below string without using any extension class. I would prefer to write a .net class which will do serialize and deserialize it. string userDetails = "{"FullName":"Manoj Singh","username":"Manoj

  • Get value from json response 2011-04-05

    I have following JSON response received from server: { "msg": "S", "comments": { "iRecords": [{ "id": "9", "bid": "1", "uid": "5", "comment": "This is # 009", "adate": "Tuesday, 5th April, 2011 11:15:05", "status": "1", "userid": "5", "username": "pa

  • how to configure spring mvc 3 to not return "null" object in json response? 2011-05-18

    a sample of json response looks like this: {"publicId":"123","status":null,"partner":null,"description":null} It would be nice to truncate out all null objects in the response. In this case, the response would become {"publicId":"123"}. Any advice? T

  • Deserializing a mixed list of objects from JSON 2011-05-24

    I'm using the DataContractJsonSerializer to deserialize objects from an external service. In most cases, this has worked great for me. However, there is one case where I need to deserialize JSON that contains a list of objects that all inherit from t

  • NSArray contains NSDictionary instead of containing objects after json response 2011-09-07

    I have a class called MobileResponse as like as below. @interface MobileResponse : NSObject { double AppVersion; NSMutableArray *Busses; NSMutableArray *Cities; NSString *Error; NSMutableArray *Lines; NSMutableArray *Points; NSMutableArray *Schedules

  • How to generate Treeview from JSON data using javascript 2011-12-19

    I am trying to create a treeview like structure from JSON data. Structure is quite simple, but the problem I am getting is while grouping the children under particular parents. For example, Input JSON data is :{'record':[{'sn':'Demo Sheet 1','vn':'De

  • How to create a JavaScript object from JSON data returned from server 2012-02-25

    I need help, I want to create a function which returns an object from an AJAX request, so I can create a new object from data on the server like this: var foo = bar('api.php?x=y'); The function should take a query string as an argument, and the serve

  • Setting TextView's text as non-English text received from JSON response 2012-03-13

    I'm getting back names of (Foursquare) venues from a server call where the names of the venues returned can be in English or non-English. Assume the venue name is in a JSON object as follows: {... "name":"venue name which can be in any language" ...}

  • Accessing an object from JSON in Android 2012-04-13

    I have a question that I am a little bit confused about. I am quite new to JSON and getting JSON values in the android API. I am trying to access an array within the response I get. the JSON code I am getting is something like this: Response: { "even

  • Grails - excluding class from JSON response works only after hot code loading 2014-06-11

    I've set up a JSON renderer in resources.groovy: ... myModelJsonRenderer(JsonRenderer, MyModel) { excludes = ['class'] } ... When I run grails run-app and try fetching all data, I still get JSON response with class property. However, when I try to up

  • Can't deserialize an array of objects from JSON into a C# object 2010-09-02

    I'm having trouble getting the JavascriptSerializer to deserialize an array of objects. I'm not terribly sure what I'm missing. Here's my object... public class HomefinderResult { public Data data; public List<Listing> listings; public Status s

  • Automatically remove generator object from memory at StopIteration (Python) 2011-08-31

    I noticed once a generator is exhausted, the object remains in memory. How can I make the generator object automatically remove itself from memory once it is exhausted? --------------Solutions------------- You could try making a wrapper generator tha

  • How to get Java objects from JSON string 2011-09-03

    How can I get Java objects from this JSON string? We don't have the name of the object in the JSON string [ { "eqid": "c0001xgp", "magnitude": 8.8, "lng": 142.369, "src": "us", "datetime": "2011-03-11 04:46:23", "depth": 24.4, "lat": 38.322 }, { "eqi

  • How does the ASIHTTPRequest know that there's new data from JSON response 2011-09-09

    I'm developing an iPhone app, that uses ASIHTTPRequest library. I''m stuck with the cache and download data. When I first open the app, it makes a request and download and cache the JSON response of the server. If I make some changes in this JSON so

  • How to get all attributes names(nested or not) in from JSON response 2011-11-18

    I have following json response. I am not able to iterate through each Map. Please help me {"status":"OK","result":{"1":{"Id":"3","Conferencce":"test3","Description":"test3","Admin":"919818559890","Moderator":null,"Keywords":"test3","StartDate":"2011-

Copyright (C), All Rights Reserved.

processed in 0.079 (s). 11 q(s)