3 from deepdiff import DeepDiff
6 """JSONUtils is common resource for simple json helper keywords."""
8 def json_equals(self, left, right):
9 """JSON Equals takes in two strings or json objects, converts them into json if needed and then compares them, returning if they are equal or not."""
10 if isinstance(left, str):
11 left_json = json.loads(left);
14 if isinstance(right, str):
15 right_json = json.loads(right);
19 ddiff = DeepDiff(left_json, right_json, ignore_order=True);
25 def make_list_into_dict(self, listOfDicts, key):
26 """ Converts a list of dicts that contains a field that has a unique key into a dict of dicts """
28 if isinstance(listOfDicts, list):
29 for thisDict in listOfDicts:
34 def find_element_in_array(self, searchedArray, key, value):
35 """ Takes in an array and a key value, it will return the items in the array that has a key and value that matches what you pass in """
37 for item in searchedArray:
39 if item[key] == value:
40 elements.append(item);