I have arranged all the users/login in ascending order except the 1st entry which is not happening? Can anybody give a solution

*** Settings ***

Documentation A script that uses the git API to fetch and print the information

Library SeleniumLibrary
Library RequestsLibrary
Library Collections
Library OperatingSystem

*** Variables ***

${base_url} https://api.github.com/

*** Test Cases ***

Search Users with Ordered Ascending (asc)

create session      Get_Users     ${base_url}             
${response_users} =    get request     Get_Users    /users
${json_users} =      evaluate    json.loads('''${response_users.content}''')    json       
${Sorted_Users} =    Evaluate    sorted(${json_users}, key=lambda d: d['login'])
log     ${Sorted_Users}

It would be nice if you make a reproducible test case, so we could experiment and identify the failure.

You can have just a sample of the data in the ${json_users} variable, so we don’t need API or JSON processing.

Thank you so much!

What do you mean by making it reproductible? I have to check from the whole API, it is not so large

I have go the solution; upper case letters are earlier than lower case. A workaround is to do a case-insensitive sort with “sorted(${json_users}, key=lambda d: d[‘login’].lower())”

Good that you have found a solution.

To be reproducible by us, you could have just changed the code like:

@{json_users} =      Create List    aardvark    zebra    Panda     Giraffe    bottleneck-beak-dolphin    Dog    cat    Addax
${Sorted_Users} =    Evaluate    sorted(${json_users}
log     ${Sorted_Users}
1 Like

Thank you so much!, now I got it