Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Get array of response using JSON Databank options

Options
Parasofttoudaya
Parasofttoudaya Posts: 232 ✭✭
edited December 2017 in SOAtest

I am looking for easiest options to add comma in between the array of elements.

I have an work around to use for in json data bank xpath regular expression. Looking for other parasoft inbuilt options.

For example,
root/customer/id[1] - One element

Expected:
root/customer/id[1] - Element1,Element2,Element3,Element4

Comments

  • jakubiak
    jakubiak Posts: 798 admin
    Options

    Can you post an example that shows the JSON you are extracting from, and the elements that you are trying to extract, along with your desired output?

  • Parasofttoudaya
    Parasofttoudaya Posts: 232 ✭✭
    Options

    @jakubiak Its just array of response..

    [
    {
    "id": "1",
    "name": "lala",
    "year": 2000,
    "price": 15.0
    }, {
    "id": "2",
    "name": "lala2",
    "year": 2000,
    "price": 125.0
    }, {
    "id": "3",
    "name": "lala",
    "year": 2000,
    "price": 15.0
    }, {
    "id": "4",
    "name": "lala2",
    "year": 2000,
    "price": 125.0
    }, {
    "id": "5",
    "name": "lala",
    "year": 2000,
    "price": 15.0
    }
    ]

    trying to fetch the id's like below

    1,2,3,4,5
    Note: There is no comma at the end.

  • jakubiak
    jakubiak Posts: 798 admin
    Options

    Thanks for the example. There is no in-built support for this. You would have to construct an XPath that could do it, or do something like convert to XML and then use XSLT to get it in the format you want.