1

私はjsonに非常に慣れていないので、正しい変数にアクセスできないようです。

たとえば、AngularJS プロジェクトのモックを作成できるように、「ユーザー名」を取得しようとしています。

$httpBackend.expectGET('user.json').
  respond(Users[ { Username: "bjarnipolo"}, { Username: "yolo"} ]);


{
  "Users":[
      {
      "UserId":1,
      "Username":"bjarnipolo",
      "Password":null,
      "FirstName":"Bjarni Póló",
      "LastName":"Súkkulaðisson",
      "Ssn":"2412813539",
      "Email":"bjarnip08@ru.is",
      "Phone":"6903066",
      "Roles":"Stjornandi",
      "JobTitle":"Scrum Master",
      "ImageUrl":"http://us.cdn4.123rf.com/168nwm/nruboc/nruboc0802/nruboc080200034/2557282-a-small-cute-dog-playing-basketball-over-a-black-background.jpg",
      "IsActive":true
      },
      {
      "UserId":2,
      "Username":"yolo",
      "Password":null,
      "FirstName":"Brynjólfur YOLO",
      "LastName":"Hermannsson",
      "Ssn":"0106752040",
      "Email":"Binni@example.com",
      "Phone":"8995555",
      "Roles":"Notandi",
      "JobTitle":"Team member",
      "ImageUrl":"http://us.cdn4.123rf.com/168nwm/nruboc/nruboc0802/nruboc080200034/2557282-a-small-cute-dog-playing-basketball-over-a-black-background.jpg",
      "IsActive":true
      }
  ]
}
4

1 に答える 1