如何在Javascript中对键值列表进行排序

我有一个带有键值对的数组。我想根据值序列对键进行排序

下面是列表

在下面的列表中,我有3个键“ 23232”,“估计基础-工件检查”和“”。因此,我想根据 questionNo 对值对象进行排序。假设密钥1有三组问题4,5,6,密钥2有问题7,8,9,密钥3有问题1,2,3。所以在我的对象集中,我希望它们作为键3设置,首先是键1,然后是键2。如果我的问题不清楚,请告诉我。

 {
  "23232": [
    {
      "questionNo": 4,"qcCorrectiveactionId": 0,"correctiveactionId": 0,"method": {
        "id": 30,"name": "Analysis Data","hpqcLoginName": null,"userId": null,"employeeId": null,"mailId": null,"correctiveactionDisableflag": true,"projectProcess": false,"orgProcess": false
      },"object": {
        "id": 27,"name": "CM Coordinator/CMB Members","correctiveactionDisableflag": false,"scoreBoardArtifact": {
        "id": 47,"name": "Architecture Document","measureStatus": {
        "id": 1,"name": "Exists?","category": {
        "id": 96,"name": "23232","question": "Test 2","createdDate": "12/20/2019","helpComment": "","pmComment": null,"analystComment": null,"comment": "","status": null,"correctactStatus": null,"actualClosureDate": null,"enableclosureDateCATitle": false,"actionRequired": null,"dueDate": null,"assignee": null
    }
  ],"Basis of Estimate - Artifact Review": [
    {
      "questionNo": 1,"method": {
        "id": 61,"name": "Add new","object": {
        "id": 25,"name": "Approval Email","measureStatus": {
        "id": 4,"name": "Signed Off?","category": {
        "id": 44,"name": "Basis of Estimate - Artifact Review","question": "Test 4","helpComment": "test toolo'u","status": "YES","assignee": null
    },{
      "questionNo": 2,"method": {
        "id": 31,"name": "Analysis 1","measureStatus": {
        "id": 2,"name": "Follows Template?","question": "Test","createdDate": "05/01/2020","": [
    {
      "questionNo": 3,"measureStatus": {
        "id": null,"name": null,"category": {
        "id": null,"assignee": null
    }
  ]
}

我的期望是

 {

 "Basis of Estimate - Artifact Review": [
    {
      "questionNo": 1,"23232": [
    {
      "questionNo": 4,"assignee": null
    }
  ]
}
cgwsb 回答:如何在Javascript中对键值列表进行排序

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/1264469.html

大家都在问