0

我的要求是为 json 消息中生成的每个新行生成一个行号。输入消息在数组中有数组,即父数组和子数组。

输入信息

                [  
           {  
              id:"1",
              Details:[  
                 {  
                    Name:"RAM",
                    LastName:"Manohar",
                    DOB:"20-10-1990",
                    Report:[  
                       {  
                          DateOfJoin:"03-03-2019",
                          Dept:"HR",
                          BillCode:"acx-12s",
                          EffectiveDate:"03-03-2019"
                       },
                       {  
                          DateOfJoin:"03-04-2019",
                          Dept:"HR",
                          BillCode:"abc-12s",
                          EffectiveDate:"03-04-2019"
                       },
                       {  
                          Name:"Alex",
                          LastName:"Ham",
                          DOB:"20-11-1980",
                          Report:[  
                             {  
                                DateOfJoin:"03-03-2019",
                                Dept:"HR",
                                BillCode:"acx-12s",
                                EffectiveDate:"03-03-2019"
                             },
                             {  
                                DateOfJoin:"03-04-2019",
                                Dept:"HR",
                                BillCode:"abc-12s",
                                EffectiveDate:"03-04-2019"
                             }
                          ]
                       }
                    ]
                 },
                 {  
                    id:"2",
                    Details:[  
                       {  
                          Name:"Kiran",
                          LastName:"Kurella",
                          DOB:"20-10-1980",
                          Report:[  
                             {  
                                DateOfJoin:"03-03-2019",
                                Dept:"DC",
                                BillCode:"acx-12s",
                                EffectiveDate:"03-03-2019"
                             },
                             {  
                                DateOfJoin:"03-04-2019",
                                Dept:"DC",
                                BillCode:"abc-12s",
                                EffectiveDate:"03-04-2019"
                             },
                             {  
                                Name:"Sunil",
                                LastName:"Kumar",
                                DOB:"20-11-1980",
                                Report:[  
                                   {  
                                      DateOfJoin:"03-01-2019",
                                      Dept:"DC",
                                      BillCode:"acx-12s",
                                      EffectiveDate:"03-03-2019"
                                   },
                                   {  
                                      DateOfJoin:"03-04-2019",
                                      Dept:"DC",
                                      BillCode:"abc-12s",
                                      EffectiveDate:"03-04-2019"
                                   }
                                ]
                             }
                          ]
                       }
                    ]
                 }
              ]
           }
        ]

预期输出:

            [{LineNumber:1,
            Dept:"HR",
            Name: "Ram"},
            {LineNumber:2,
            Dept:"HR",
            Name: "Alex"},
            {LineNumber:3,
            Dept:"HR",
            Name: "Kiran"},
            {LineNumber:4,
            Dept:"HR",
            Name: "Sunil"}]

Linenumber 需要按顺序生成,与父数组或子数组无关。对此的任何帮助将不胜感激。我有可以使用java函数生成数字的逻辑,但在这种情况下,我需要在数据编织中设置变量值(流变量),它可以在java函数中用于递归调用。

4

1 回答 1

0

使用:有效载荷映射{计数:$$}

于 2019-03-19T13:27:09.467 回答