Javascript 选择2中的多个选项

Javascript 选择2中的多个选项,javascript,jquery-select2,Javascript,Jquery Select2,我尝试使用select2获取远程JSON数据,并以多个级别显示它。 这是我的回答 { "Company": [ { "name": "athenahealth Inc" }, { "name": "Localiza Rent a Car" }, { "name": "M and B Switchgears" } ], "Functional": [ { "name": "arra

我尝试使用select2获取远程JSON数据,并以多个级别显示它。

这是我的回答

{
  "Company": [
    {
      "name": "athenahealth Inc"
    },
    {
      "name": "Localiza Rent a Car"
    },
    {
      "name": "M and B Switchgears"
    }
  ],
  "Functional": [
    {
      "name": "arranger"
    },
    {
      "name": "ambassadors"
    }
  ],
  "Persons": [
    {
      "name": "Moustapha al"
    },
    {
      "name": "Saleh al"
    }
  ]
}
我想以多值格式显示结果-


到目前为止,我能够从服务器端获取数据,但我不知道如何启用multi-select选项。

以下格式的JSON可以正常工作

相关问题-

{ "Data" : [ {
            "id" :1 ,
            "text" : "Subsection" ,
            "children" : [{
                    "id" : 2,
                    "text" : "Paru"
                      },
                      {
                    "id" : 3,
                    "text" : "Vinu"
                      }]
        },
            { "id" : 4 ,
            "text" : "Family" ,
            "children" : [{
                    "id" : 5,
                    "text" : "ChildVM"
                      },
                      {
                    "id" : 6,
                    "text" : "ChildPM"
                      }]
        }
           ]    
}