cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert Database Response to Json response using groovy script

khalni02
New Contributor

How to convert Database Response to Json response using groovy script

 
2 REPLIES 2
nmrao
Community Hero

Re: How to convert Database Response to Json response using groovy script

The question is too generic. Would you mind providing same input data and expected output data?


Regards,
Rao.
khalni02
New Contributor

Re: How to convert Database Response to Json response using groovy script

I have two responses one is Web Service Response:

{
"summary": {
"apiVersion": "V1",
"apiName": "GetDataContextReferences"
},
"errors": null,
"action": "COMPLETE",
"warnings": null,
"dataContextReference": [
{
"id": 2,
"name": "LIVE"
},
{
"id": 3,
"name": "STAGING"
},
{
"id": 1,
"name": "DRAFT"
},
{
"id": 4,
"name": "ARCHIVE"
}
]
}

 

2. JDBC Response 

<Results>
<ResultSet fetchSize="0">
<Row rowNumber="1">
<DATA_CONTEXT_REFERENCE_LOOKUP.ID>2</DATA_CONTEXT_REFERENCE_LOOKUP.ID>
<DATA_CONTEXT_REFERENCE_LOOKUP.NAME>LIVE</DATA_CONTEXT_REFERENCE_LOOKUP.NAME>
</Row>
<Row rowNumber="2">
<DATA_CONTEXT_REFERENCE_LOOKUP.ID>3</DATA_CONTEXT_REFERENCE_LOOKUP.ID>
<DATA_CONTEXT_REFERENCE_LOOKUP.NAME>STAGING</DATA_CONTEXT_REFERENCE_LOOKUP.NAME>
</Row>
<Row rowNumber="3">
<DATA_CONTEXT_REFERENCE_LOOKUP.ID>1</DATA_CONTEXT_REFERENCE_LOOKUP.ID>
<DATA_CONTEXT_REFERENCE_LOOKUP.NAME>DRAFT</DATA_CONTEXT_REFERENCE_LOOKUP.NAME>
</Row>
<Row rowNumber="4">
<DATA_CONTEXT_REFERENCE_LOOKUP.ID>4</DATA_CONTEXT_REFERENCE_LOOKUP.ID>
<DATA_CONTEXT_REFERENCE_LOOKUP.NAME>ARCHIVE</DATA_CONTEXT_REFERENCE_LOOKUP.NAME>
</Row>
</ResultSet>
</Results><Results>
<ResultSet fetchSize="0">
<Row rowNumber="1">
<DATA_CONTEXT_REFERENCE_LOOKUP.ID>2</DATA_CONTEXT_REFERENCE_LOOKUP.ID>
<DATA_CONTEXT_REFERENCE_LOOKUP.NAME>LIVE</DATA_CONTEXT_REFERENCE_LOOKUP.NAME>
</Row>
<Row rowNumber="2">
<DATA_CONTEXT_REFERENCE_LOOKUP.ID>3</DATA_CONTEXT_REFERENCE_LOOKUP.ID>
<DATA_CONTEXT_REFERENCE_LOOKUP.NAME>STAGING</DATA_CONTEXT_REFERENCE_LOOKUP.NAME>
</Row>
<Row rowNumber="3">
<DATA_CONTEXT_REFERENCE_LOOKUP.ID>1</DATA_CONTEXT_REFERENCE_LOOKUP.ID>
<DATA_CONTEXT_REFERENCE_LOOKUP.NAME>DRAFT</DATA_CONTEXT_REFERENCE_LOOKUP.NAME>
</Row>
<Row rowNumber="4">
<DATA_CONTEXT_REFERENCE_LOOKUP.ID>4</DATA_CONTEXT_REFERENCE_LOOKUP.ID>
<DATA_CONTEXT_REFERENCE_LOOKUP.NAME>ARCHIVE</DATA_CONTEXT_REFERENCE_LOOKUP.NAME>
</Row>
</ResultSet>
</Results>

 

How can I write a groovy script to match theses two outputs?

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors