Use JSON and JSONP format together in Yii2 REST API

I’m new in yiiframework,

I want use JSONP and JSON format [together] in Yii2 REST api, it’s means if a api call normal response json and if a api call with jsonp ajax, get JSONP result, I can’t find anything in forums or stackoverflow to config that. How to i do it?

Thank you.

tips: JSON Formatter