Here is program code, I have one json file code.json which structure is like this : [ {key:value}, {key:value} ]
When I convert list element into dictionary , it throws error
*** Settings ***
Library JSONLibrary
Library OperatingSystem
Library unicodelist.py
Library Collections
*** Test Cases ***
test json data1
${json_obj}= Get file code.json
${getfile}= evaluate json.loads('''${json_obj}''') json
#getfile contain json of list with dictionary
${obj}= Convert To List ${getfile}
log to console ${obj}
#converted sucessfully
log to console " Display 1"
#just log
${length}= get length ${obj}
log to console ${length}
${list0} = Get From List ${obj} 0
log to console ${list0}
#list0 contain first dictionary element inside the list
${convert}= Convert To Dictionary ${list0}
log to console ${convert}
# no error
log to console " Display 2"
${get_item} = Get Dictionary Keys ${obj}
log to console ${get_item}
#error list' object has no attribute 'Keys'
log to console " Display 3"
${get_item} = Copy Dictionary ${obj}
log to console ${get_item}
# error list' object has no attribute 'copy'