Array with single element is not getting populated within [] in Talend using MongoDB output

Viewed 72

I am trying to insert a JSON document with arrays into the target mongoDB and the issue I am facing is array with one element is not getting enclosed within square brackets whereas array with more than one element is working fine.

Single element:

"project" : {

      "projectName" : "AAU",

      "delay" : "0 days",

      "projectBudget" : "315000000"

    }

Multiple elements:

"project" : [

        {

          "projectName" : "AAD",

          "delay" : "3 days",

          "projectBudget" : "90000000"

        }, 

        {

          "projectName" : "AAE",

          "delay" : "3 days",

          "projectBudget" : "105000000"

        }

      ]

Output expected: Even for single element output to come within square brackets [ ]

"project" :[ {

      "projectName" : "AAU",

      "delay" : "0 days",

      "projectBudget" : "315000000"

    }

]

Any help on this is much appreciated.

Thanks!

0 Answers
Related