The sort-json operation sorts a JSON document recursively. Object keys are sorted alphabetically, and arrays are sorted according to the values they contain. Nested objects and arrays are processed as well, so the ordering is applied throughout the JSON structure rather than only at the top level.