Validation in SOA Test
Comments
-
Please read this earlier thread in case this helps you:
https://forums.parasoft.com/discussion/3465/diff-json-comparision-by-ignoring-the-order0 -
Link says on converting the entire json to complete xml but I have extracted values from specific key which has multiple values and is not in either json or xml format and want to format the same in xml to use xml sort for comparison.How this can be done?
0 -
You would need to provide a concrete example so that we better understand what you are doing. For example, the user in that other post submitted a sample JSON document and described what parts needed validation. Depending on your specific case, extracting values at specific indices may be the wrong approach since you would have no idea what you are extracting if the order isn't guaranteed.
Generally you solve out-of-order problems by sorting the message. You can convert to XML then either use the XML Sort tool or do an XML diff with the "Ignore element order" option. If you you convert to XML then sort the XML, you can even covert it back to JSON again then try doing the original extractions you were attempting, since the order will be guaranteed at that point with the document being sorted.
0 -
Hi Ben
In the given example source and target were constructed json format. In my case extracted fields, Let me know if you have any option to construct as json/xml.Example,
[
{
"id":123456
"customerName": "ppp"
},
{
"id":123456
"customerName": "rrr"
},
{
"id":123456
"customerName": "iii"
},
{
"id":123456
"customerName": "yyy"
},
{
"id":123456
"customerName": "aaa"
}]i extracts using jsonDataBank \root\id[*]
How should i extract this as constructed json/xml???
Thanks
Priya0