LoginSignup
1
2

More than 5 years have passed since last update.

jsFiddle + AngularJS > JSON > JSON項目の取得

Last updated at Posted at 2016-03-21

http://qiita.com/api/v2/schema
からJSON文字列を取得して、descriptionという項目を取得するサンプル。

code

<div ng-controller="MyCtrl">
  Hello, {{name1}}
  <hr>
  Res, {{result}}
</div>
var myApp = angular.module('myApp',[]);

function MyCtrl($scope, $http) {
      $http.get('http://qiita.com/api/v2/schema').success(function(data, status, headers, config) {
      $scope.name1 = data;
    $scope.result = data.description;
        });
}
{"description":"このスキーマ定義では、Qiita API v2 のインターフェースをJSON Hyper Schema draft v4形式で表現しています。","properties":{"access_token":{"description":"Qiita API v2で認証・認可を行うためのアクセストークンを表します。","links":[{"description":"与えられた認証情報をもとに新しいアクセストークンを発行します。","href":"/api/v2/access_tokens","method":"POST","rel":"create","schema":{"properties":{"client_id":{"description":"登録されたAPIクライアントを特定するための…

というようなJSON文字列から以下の文字列が取得できた。

このスキーマ定義では、Qiita API v2 のインターフェースをJSON Hyper Schema draft v4形式で表現しています。
1
2
7

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2