How to integrate third-party widgets and Yii2 restfull api?

There is for example a set of widgets, kartik-v. They prinout the json in your format to for example, option, a separate field with the selected value. There is a standard option in Yii to work with restfull who gives in his "format" of json. As much as possible, without making the crutch on both sides of the most convenient all this together without much effort?
July 2nd 19 at 17:01
2 answers
July 2nd 19 at 17:03
JSON it JSON and Africa, it one format everywhere. There may be a different response structure, but the format is always the same. Nothing prevents You from using Yii2 to make a structure as You need in a certain situation. For example, the same kartik
public function actionGetData(){
 Yii::$app->response->format = 'json';
 return [
 'output'=> $data,
 'selected'=> ", 
]
}
July 2nd 19 at 17:05
Yes, I agree that it is possible to change the structure, but it turns out in this case you need to customize the functionality yii2 restfull, overriding methods actionIndex - prepareDataProvider

Find more questions by tags Yii