2017年1月7日土曜日

JSONを確認出来るweb toolでRESTのデータを見てみる

RESTで取得したjsonデータをペーストすると、整形してくれるサイトです。
java script(ローカル)で動いているそうなので、心配しなくても良さそう?です。

https://syncer.jp/json-prettyprint

API
wether hacks
http://weather.livedoor.com/weather_hacks/

こちらを整形してもらうと、以下の出力が得られました。
構造としては、
pinpointLocations : valueの配列
  link : url
  name : 都市名
    の配列が続く
link : リクエストしたurl(長野市と思われる2020100になっている)
forecasts : 日付ごとの配列 (今日・明日の2つ)
 dataLabel : 日付
 telop : 概略
 date : 日付
 temperature : maxとminのobject
 image : 図など
location : 場所の説明
  中略
title : タイトル
desctiption : 天気概要



{
    "pinpointLocations": [
        {
            "link": "http://weather.livedoor.com/area/forecast/2020100",
            "name": "長野市"
        },
        {
            "link": "http://weather.livedoor.com/area/forecast/2020111",
            "name": "長野"
        },
        {
            "link": "http://weather.livedoor.com/area/forecast/2020112",
            "name": "鬼無里戸隠"
        },
        // *** 中略 ***
        {
            "link": "http://weather.livedoor.com/area/forecast/2060200",
            "name": "栄村"
        }
    ],
    "link": "http://weather.livedoor.com/area/forecast/200010",
    "forecasts": [
        {
            "dateLabel": "今日",
            "telop": "曇のち雪",
            "date": "2017-01-09",
            "temperature": {
                "min": null,
                "max": {
                    "celsius": "6",
                    "fahrenheit": "42.8"
                }
            },
            "image": {
                "width": 50,
                "url": "http://weather.livedoor.com/img/icon/14.gif",
                "title": "曇のち雪",
                "height": 31
            }
        },
        {
            "dateLabel": "明日",
            "telop": "曇時々雪",
            "date": "2017-01-10",
            "temperature": {
                "min": {
                    "celsius": "0",
                    "fahrenheit": "32.0"
                },
                "max": {
                    "celsius": "6",
                    "fahrenheit": "42.8"
                }
            },
            "image": {
                "width": 50,
                "url": "http://weather.livedoor.com/img/icon/11.gif",
                "title": "曇時々雪",
                "height": 31
            }
        },
        {
            "dateLabel": "明後日",
            "telop": "曇時々雪",
            "date": "2017-01-11",
            "temperature": {
                "min": null,
                "max": null
            },
            "image": {
                "width": 50,
                "url": "http://weather.livedoor.com/img/icon/11.gif",
                "title": "曇時々雪",
                "height": 31
            }
        }
    ],
    "location": {
        "city": "長野",
        "area": "信越・北陸",
        "prefecture": "長野県"
    },
    "publicTime": "2017-01-09T11:00:00+0900",
    "copyright": {
        "provider": [
            {
                "link": "http://tenki.jp/",
                "name": "日本気象協会"
            }
        ],
        "link": "http://weather.livedoor.com/",
        "title": "(C) LINE Corporation",
        "image": {
            "width": 118,
            "link": "http://weather.livedoor.com/",
            "url": "http://weather.livedoor.com/img/cmn/livedoor.gif",
            "title": "livedoor 天気情報",
            "height": 26
        }
    },
    "title": "長野県 長野 の天気",
    "description": {
        "text": " 低気圧が関東の東海上を発達しながら東北東へ進んでいます。\n\n 長野県内は、曇りまたは晴れとなっています。\n\n 9日は、冬型の気圧配置となりますが、寒気の影響を受ける見込みです。\n このため、北部では、曇りで夜は雪となり、雷を伴う所があるでしょう。\n中部と南部では、晴れで夕方からは曇りとなり、中部では夜は雪の降る所が\nあるでしょう。\n\n 10日は、冬型の気圧配置が続きますが、寒気の影響を受ける見込みです\n。\n このため、北部では、曇りで朝晩は雪となり、夜は雷を伴う所があるでし\nょう。中部と南部では、晴れますが、夜は雲が広がり、乗鞍上高地地域では\n雪が降るでしょう。",
        "publicTime": "2017-01-09T11:23:00+0900"
    }
}

Web APIのサイト紹介
https://wp-d.org/2013/03/14/3348/

0 件のコメント:

コメントを投稿