How to read the data from the json file and return it as a string or object in angularJS?


personManagerInstance.getString("firstname",'common','en') currently i pass direct string in ui its affecting but what i exactly need is read the data from json file and return as string..

personManagerInstance.getString("firstname",'common','en') method i need to read the data from json file and return as string or object?

personManagerInstance.getString("lastname",'registration','en') this method based on parameter read json from different location and return as string...

var PersonManager = function ()
  return {
    $get: function ($http, person)
       var mainInfo = $http({
                              method: "get",
                              url: "js/resources-locale_en_es.json"
                          }).success(function (data) {
                               return data.title;
      return {
        getPersonFirstName: function ()
          return "as";
        getPersonLastName: function ()
          return person.lastName;
        getString: function (labelid, moduleName, language)
          //Here am getting the value id, moduleName, language based on the vaule I need to change the url path
          //(i.e) js/resources-locale_en_es.json, js/registration/resources-locale_en_es.json

          var l = mainInfo.success(function (data) {
                               person.firstName = data.title;
          return person.firstName;

angular.module("mainModule", [])
  .value("person", {
    firstName: "",
    lastName: ""
  .provider("personManager", PersonManager)
  .controller("mainController", function ($scope, person, personManager)
    person.firstName = "John";
    person.lastName = "Doe";
    $scope.personInstance = person;
    $scope.personManagerInstance = personManager;

<!DOCTYPE html>
<script src=""></script>
<script language="javascript" type="text/javascript" src=""></script>

  <script src="script.js"></script>

<body ng-app="mainModule">
  <div ng-controller="mainController">
    <strong>First name:</strong> {{personManagerInstance.getPersonFirstName()}}<br />
    <strong>Last name:</strong> {{personManagerInstance.getPersonLastName()}}<br />
    <strong>Full name:</strong> {{personManagerInstance.getString("firstname",'common','en')}}  {{personManagerInstance.getString("lastname",'registration','en')}}<br />
    <br />
    <label>Set the first name: <input type="text" ng-model="personInstance.firstName"/></label><br />
    <label>Set the last name: <input type="text" ng-model="personInstance.lastName"/></label>

I don't see any trouble of using $http.get('file.json'), you can use angular.toJson(result) to convert JSON string to object later on.