Reputation: 49
I'm getting a JSON response for my API. Now I need to compare all the nodes present in the JSON response with my XLM file.
Example:
Json response:
> {fields=[{field_id=UDF_CHAR1, is_visible=true, default_value=null,
> field_type=single_line, field_name=build name}
XML file:
<template name="fields">
<key name="field_id" type="String" />
<key name="is_visible" type="Boolean" />
<key name="default_value" type="String_or_null" />
<key name="field_type" type="String" />
<key name="field_name" type="String" />
</template>
How can i compare all the key values in my xml file with all the nodes in the JSON response.
Upvotes: 1
Views: 2420
Reputation: 64
Please follow these steps
Create a class(may be a modal class) that can keep data of the XML file and JSON response. Eg:
class Fields { String fieldId; boolean isVisible; }
Add a method(function) to compare two instance of above class. Eg: public boolean isEqualFields(Fields anotherField);
Upvotes: 0
Reputation: 642
Upvotes: 3