Forum Discussion

davecoleman's avatar
davecoleman
Contributor
4 years ago

Extract nested JSON response values in DataSource for JSON - how to export to file / excel?

Hi all,

I have a datasource for JSON which looks at the response of a REST Response is outputting the nested array of IDs within it.

there are e.g. 8 values output for this response of "bookingID". How do I pass this to a dataSink to output in an Excel file? I went to complete this but only the last value is output.

 

  • Richie, nmrao, thank you for your help!

     

    Hi davecoleman ! Were you able to solve this? Please share your solution with the Community if you were.

    Otherwise, please either provide nmrao with the info they are requesting or, alternatively, contacting support can bring clarity to this, as well. 

  • richie's avatar
    richie
    Community Hero
    Hey davecoleman,

    Could you confirm exactly what the json looks like please? I always struggle with the row path and column path fields on this thing.

    Ta,

    Rich
    • davecoleman's avatar
      davecoleman
      Contributor

      Hi richie 

      Hope this helps. Don't want to give away the full listing.

       

      I ran the full functional test and it only output 1 value when there should be a few thousand. it comes down to an array on the output from this datasource. I can look towards a Groovy script but if ReadyAPI provides it without scripting, even better.

       

      • richie's avatar
        richie
        Community Hero
        Hey davecoleman,

        Cheers i just needed to appreciate the basic structure, so the bookings attribute is either an object or array and it contains repeating objects which contains a bookingId attribute and you want to save off the bookingId attribute values.....right?

        Yeah, its gonna need some groovy i reckon. The way you have setup the datasource has a single transfer property....each one would park off a single bookingId. I dont see any way of doing it....especially as you say there could be many and the number isnt fixed.

        Dunno if anyone else can think of any other non groovy options, but i cant!

        Ta

        Rich