Open this example in the interactive library
Source code
SELECT key AS part,value AS stock FROM json_each('{"pad":3,"pen":5}') ORDER BY stock DESC;
Sample output
[
{
"part": "pen",
"stock": 5
},
{
"part": "pad",
"stock": 3
}
]