Reputation: 1
I want to create json from multiple selection from listbox in yii2 after post i receive following data
categorymodel[0]=11&categorymodel[1]=12&categorymodel[2]=13
how to convert to json data and store in db.
json data like {"11","12","13"}
Upvotes: 0
Views: 211
Reputation: 133370
Once you have the proper array you can use eg:
$retJSON= json_encode($categoryModel);
Upvotes: 1