2 Replies Latest reply on Jan 30, 2015 4:51 PM by cjwallac

    JSON responce from REST

    cjwallac

      I have successfully used GET to obtain JSON data from a REST endpoint. I would like now to use a SCRIPT task to parse the returned JSON. My challenge is that I don't seem to use any of the JSON object to help me accomplish my parsing. Do i need to add a jar for to dependencies to do this? If so can you please help me with the steps to properly added new classes? I have seen many different ways of doing this and most of them require a and clean.demo which then I seem to loose all my processes. I appreciate your help and this for your support!

        • 1. Re: JSON responce from REST
          sanjay05222

          Christopher Wallace wrote:

           

          I have successfully used GET to obtain JSON data from a REST endpoint. I would like now to use a SCRIPT task to parse the returned JSON. My challenge is that I don't seem to use any of the JSON object to help me accomplish my parsing. Do i need to add a jar for to dependencies to do this? If so can you please help me with the steps to properly added new classes? I have seen many different ways of doing this and most of them require a and clean.demo which then I seem to loose all my processes. I appreciate your help and this for your support!

          I may not have all the answers right now but you can do onething is that you can look into the ant build.xml and when you do the clean.demo at that point you can comment out the clean repository part in order to save your work .  OR

          you should not do clean.demo I dont know why you have to . you should be able to continue working on the things as is. Please provide more details is two why you need to do clean demo every time ? I may be able to help you in that regards . for the REST solution please wait I would have something. thanks

          1 of 1 people found this helpful
          • 2. Re: JSON responce from REST
            cjwallac

            I was just follow other solutions and they where all doing clean.  If it's not required that good and I don't have a special requirement. The better solution in my opinion would if we could figure out how to use the native java JSON parser the Oracle provides in the SCRIPT node and not have to load any dependencies. I have not bee able estanciated the JSON parses from script node is the core challenge I current have as follows:

             

            JsonArray results = obj.getJsonArray("data");

            for (JsonObject result : results.getValuesAs(JsonObject.class)) {

                     System.out.print(result.getJsonObject("id").getString("name"));

                     System.out.print(": ");

                     System.out.println(result.getString("message", ""));

                     System.out.println("-----------");

            }

             

            Attempting to create no new dependencies and have not been successful.

             

            Thank You for your insight!