I am curious if it is possible to arrange the keys in a JSON object as an array based on their values.
Here is the JSON object:
{
"p1": {
"name": "*****",
"age": "18"
},
"p2": {
"name": "*****",
"age": "14"
},
"p3": {
"name": "*****",
"age": "24"
}
}
I want to sort them in ascending order by the value of the subkey "age," like this:
["p2", "p1", "p3"]
I haven't attempted anything yet because I'm not sure how. Could someone provide me with an example?