Submit select2 multiple values in json format

I want to submit the multiple values of the select tag in json,

I have populated the option from ajax

If you’re just using a regular HTML form submit button then you’ll always get the standard HTML method of passing multiple selections from a <select>, which does not use JSON.

To submit JSON (stringified, of course), you’ll have to write some JavaScript that runs when the form is submitted (i.e., an onSubmit event handler). Your event handler should retrieve the selected value(s) from the Select2, pass that result (a JavaScript array) to JSON.stringify(), and then submit that JSON string to the server (for example, by inserting that string into a hidden form field).