Get array of response using JSON Databank options

ParasofttoudayaParasofttoudaya Posts: 199 ✭✭
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

  • jakubiakjakubiak Posts: 353 admin

    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?

  • ParasofttoudayaParasofttoudaya Posts: 199 ✭✭

    @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.

  • jakubiakjakubiak Posts: 353 admin

    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.

Sign In or Register to comment.