{"action":"created","issue":{"url":"https://api.github.com/repos/stedolan/jq/issues/784","labels_url":"https://api.github.com/repos/stedolan/jq/issues/784/labels{/name}","comments_url":"https://api.github.com/repos/stedolan/jq/issues/784/comments","events_url":"https://api.github.com/repos/stedolan/jq/issues/784/events","html_url":"https://github.com/stedolan/jq/issues/784","id":75636044,"number":784,"title":"Can't work out how to sort_by","user":{"login":"kaihendry","id":765871,"avatar_url":"https://avatars.githubusercontent.com/u/765871?v=3","gravatar_id":"","url":"https://api.github.com/users/kaihendry","html_url":"https://github.com/kaihendry","followers_url":"https://api.github.com/users/kaihendry/followers","following_url":"https://api.github.com/users/kaihendry/following{/other_user}","gists_url":"https://api.github.com/users/kaihendry/gists{/gist_id}","starred_url":"https://api.github.com/users/kaihendry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaihendry/subscriptions","organizations_url":"https://api.github.com/users/kaihendry/orgs","repos_url":"https://api.github.com/users/kaihendry/repos","events_url":"https://api.github.com/users/kaihendry/events{/privacy}","received_events_url":"https://api.github.com/users/kaihendry/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-05-12T15:12:56Z","updated_at":"2015-05-13T01:27:32Z","closed_at":null,"body":"Using jq-1.4, I can't work out how to sort a JSON file by `.NextBus.EstimatedArrival`. What am I missing from:\r\n\r\n    curl -s http://s.natalian.org/2015-05-12/sg-bus.json | jq '.Services[] | sort_by(.NextBus.EstimatedArrival)'\r\n\r\n\r\nWhich results in errors like \"jq: error: Cannot index array with string\".\r\n\r\nIdeally I want to sort in place, i.e. print out the original JSON, only sorted by **EstimatedArrival**"},"comment":{"url":"https://api.github.com/repos/stedolan/jq/issues/comments/101477565","html_url":"https://github.com/stedolan/jq/issues/784#issuecomment-101477565","issue_url":"https://api.github.com/repos/stedolan/jq/issues/784","id":101477565,"user":{"login":"pkoppstein","id":172847,"avatar_url":"https://avatars.githubusercontent.com/u/172847?v=3","gravatar_id":"","url":"https://api.github.com/users/pkoppstein","html_url":"https://github.com/pkoppstein","followers_url":"https://api.github.com/users/pkoppstein/followers","following_url":"https://api.github.com/users/pkoppstein/following{/other_user}","gists_url":"https://api.github.com/users/pkoppstein/gists{/gist_id}","starred_url":"https://api.github.com/users/pkoppstein/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pkoppstein/subscriptions","organizations_url":"https://api.github.com/users/pkoppstein/orgs","repos_url":"https://api.github.com/users/pkoppstein/repos","events_url":"https://api.github.com/users/pkoppstein/events{/privacy}","received_events_url":"https://api.github.com/users/pkoppstein/received_events","type":"User","site_admin":false},"created_at":"2015-05-13T01:27:32Z","updated_at":"2015-05-13T01:27:32Z","body":"Use `|=` instead of `=`.\r\n\r\nThat is:\r\n```\r\n.Services |= sort_by(.NextBus.EstimatedArrival)\r\n```\r\nIf effect, this says: copy the object but update the .Services value."}}