Is there any way in drupal to get all primary links through views? My objective is to get the primary links or any kind of menus items, to be shown as JSON, so that an app could consume it and show it.

I tried it using views and I have services module and views_datasource as well, but no success.

If there is no easy way then I am open to build a custom module as well.
Any suggestions?
Can you create a hook_menu() and then in the callback do a https://api.drupal.org/api/drupal/includes!menu.inc/function/menu_tree_all_data/7 to get the menu tree and then expose that to services or return  json.