Files
wlan-testing/lanforge/lanforge-scripts/py-scripts/lf_json_util.py
2022-11-21 12:31:34 +05:30

20 lines
673 B
Python

def standardize_json_results(results):
'''
standardize_json_results takes a dict of information retrieved from json_get and standardizes it to use the plural version of
the data requested.
The data is returned starting with the "endpoints"
TODO: Add functionality to handle other plural vs singular data representations
'''
if 'endpoints' not in results:
tmp_results = {}
print(results)
results = results['endpoint']
name = results['name']
tmp_results['endpoints'] = []
tmp_results['endpoints'].append({results['name']: results})
results = tmp_results
return results['endpoints']