Sep-13-2019, 06:38 AM
Hi All,
Need help to convert the input dictionary to o/p below format
input:
Need help to convert the input dictionary to o/p below format
input:
[{'type': 'cummulative', 'environment': None, 'domain': 'ARRAW', 'total_hits': 7, 'success': 1, 'failure': 6}, {'type': 'cummulative', 'environment': None, 'domain': 'WQAT', 'total_hits': 33, 'success': 26, 'failure': 7}, {'type': 'environment', 'environment': 'ACP', 'domain': 'WQAT', 'total_hits': 11, 'success': 11, 'failure': 0}, {'type': 'environment', 'environment': 'DIT', 'domain': 'ARRAW', 'total_hits': 7, 'success': 1, 'failure': 6}, {'type': 'environment', 'environment': 'DIT', 'domain': 'WQAT', 'total_hits': 11, 'success': 4, 'failure': 7}, {'type': 'environment', 'environment': 'INT', 'domain': 'WQAT', 'total_hits': 11, 'success': 11, 'failure': 0}]required O/P:
{ WQAT:[{cummulative:[{'environment': None, 'domain': 'WQAT', 'total_hits': 33, 'success':26, 'failure': 7}], environment: [{'environment':'ACP', 'domain': 'WQAT', 'total_hits': 11, 'success': 11, 'failure': 0}, {'environment': 'DIT', 'domain': 'WQAT', 'total_hits': 11, 'success': 4, 'failure': 7}, {'environment': 'INT', 'domain': 'WQAT', 'total_hits': 11, 'success': 11, 'failure': 0}] ARRAW: [{cummulative:[{'environment': None, 'domain': 'ARRAW', 'total_hits': 7, 'success': 1, 'failure': 6}], environment: [ {'environment': 'DIT', 'domain': 'ARRAW', 'total_hits': 7, 'success': 1, 'failure': 6}] }