python, sorting a dict/json
der.hans
PLUGd at LuftHans.com
Fri Feb 22 12:21:49 MST 2019
moin moin,
I'm trying to sort some data that is currently in json being imported into
a dict.
It's essentially bibliography information, but without a unique ID.
I mostly want to sort on publication date, but also want to group by
publication. There could be multiple publications on the same date.
Currently using a json format like:
{
"pubs": [
{
"date": 20190222
"title": "a title"
"url": "https://some.domain/page.html"
},
{
"date": 20190221
"title": "another title"
"url": "https://some.other.domain/page.html"
}
]
}
Format can change if that helps.
I want to be able to display items in order. Mostly chronological, but
also by other details.
Any suggestions for how to sort them for display?
A nice, but not required, feature would be sorting them for saving to disk
as well.
ciao,
der.hans
--
# https://www.LuftHans.com https://www.PhxLinux.org
# "You want weapons? We're in a library! Books! The best weapons in the
# world! This room's the greatest arsenal we could have - arm yourselves!"
# -- the Doctor: Doctor Who, Tooth and Claw, 2006
More information about the PLUG-discuss
mailing list