I'm learning how to use json with python and I wanted to know how to sort a json file alphabetically. Here is the file:
{
"data": [
{
"text": "first sentence",
"entities": [
]
},
{
"text": "second sentence",
"entities": [
]
},
{
"text": "third sentence",
"entities": [
]
},
{
"text": "fourth sentence",
"entities": [
]
}
]
}
I would like the items in the data list to be in alphabetical order by the "text" key, and then to save that result into a new json file. Thank you for the help :)