{"id":8393,"date":"2022-07-22T05:59:27","date_gmt":"2022-07-21T20:59:27","guid":{"rendered":"https:\/\/yumishin.com\/?p=8393"},"modified":"2022-07-22T05:59:27","modified_gmt":"2022-07-21T20:59:27","slug":"aws-lambda-2","status":"publish","type":"post","link":"https:\/\/yumishin.com\/?p=8393","title":{"rendered":"\u3010aws\u30fblambda\u30fbnode.js\u3011lambda\u5185\u306ejson\u306e\u8981\u7d20\u306e\u5024\u304c\u306a\u305c\u304b\u53d6\u5f97\u3067\u304d\u305a\u30014\u6642\u9593\u3055\u307e\u3088\u3063\u305f\u8a71"},"content":{"rendered":"<p>&nbsp;<\/p>\n<h2 id=\"i-0\">\u3010aws\u30fblambda\u3011lambda\u5185\u306ejson\u306e\u8981\u7d20\u306e\u5024\u304c\u306a\u305c\u304b\u53d6\u5f97\u3067\u304d\u305a\u30014\u6642\u9593\u3055\u307e\u3088\u3063\u305f\u8a71<\/h2>\n<h3 id=\"i-1\">\u7d50\u8ad6<\/h3>\n<ul>\n<li>json\u5f62\u5f0f\u306e\u30d5\u30a1\u30a4\u30eb\u3060\u3068\u601d\u3063\u3066\u3044\u305f\u3089\u3001json\u306e\u3088\u3046\u306a\u5f62\u3092\u3057\u305fstring\u3060\u3063\u305f<\/li>\n<li>Json.parse(\u898b\u305f\u76ee\u304cjson\u307d\u3044string)\u3092\u3057\u3066\u3042\u3052\u305f\u3089\u3001\u3046\u307e\u304f\u52d5\u4f5c\u3059\u308b\u3088\u3046\u306b\u306a\u3063\u305f<\/li>\n<li>4\u6642\u9593\u5f77\u5fa8\u3063\u305f\u306e\u3067\u3001\u7cbe\u795e\u7684\u30c0\u30e1\u30fc\u30b8\u304c\u5927\u304d\u304b\u3063\u305f<\/li>\n<\/ul>\n<h3 id=\"i-2\">\u6982\u8981<\/h3>\n<p>aws lambda\u3092\u4f7f\u3063\u3066\u3001json\u5f62\u5f0f\u306e\u30c7\u30fc\u30bf\u3092\u51e6\u7406\u3057\u3066\u307e\u3057\u305f\u3002<\/p>\n<p>\u898b\u305f\u76ee\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u611f\u3058\u306e\u666e\u901a\u306ejson\u30d5\u30a1\u30a4\u30eb\u3001\u3001\u3001\u3067\u3059\u3002<\/p>\n<div class=\"pre_tag\"><span><i class=\"fa fa-code\"><\/i> \u30b3\u30fc\u30c9<\/span><\/p>\n<pre><code>{ \"incident_level\": \"0\", \"incident_details\": \"Normal Voltage\", \"device_name\": \"ABC99999\", \"device_voltage\": \"40\" }<\/code><\/pre>\n<\/div>\n<p>\u306a\u306e\u3067\u3059\u304c\u3001\u3053\u306ejson\u306e\u8981\u7d20\u3092\u53d6\u5f97\u3057\u3088\u3046\u3068\u601d\u3063\u3066\u3082\u3001\u53d6\u5f97\u3067\u304d\u306a\u3044\u3001\u3001\u3001\u3068\u3044\u3046\u4e8b\u4ef6\u3067\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u611f\u3058\u3067\u3001\u666e\u901a\u53d6\u5f97\u3067\u304d\u307e\u3059\u3002<\/p>\n<div class=\"pre_tag\"><span><i class=\"fa fa-code\"><\/i> \u30b3\u30fc\u30c9<\/span><\/p>\n<pre><code>const data = { \"incident_level\": \"0\", \"incident_details\": \"Normal Voltage\", \"device_name\": \"TPC99999\", \"device_voltage\": \"40\" };\nconsole.log(data.incident_level); # incident_level\u306b\u8a72\u5f53\u3059\u308b'0'\u304c\u8868\u793a\u3055\u308c\u308b\u306f\u305a\u3001\u3001\u3001\u306a\u306e\u306bundefined\u3001\u3001\u3001\u3068\u51fa\u308b\n<\/code><\/pre>\n<\/div>\n<p>\u3057\u304b\u3057undefiend\u3068\u3057\u3066\u53d6\u5f97\u3067\u304d\u307e\u305b\u3093\u3002<\/p>\n<p>\u306a\u3093\u3067\u3060\u3001\u3001\u30014\u6642\u9593\u5f77\u5fa8\u3063\u305f\u7d50\u679c\u3001\u3001\u3001json\u306e\u898b\u305f\u76ee\u3092\u3057\u305f\u3001string\u3060\u3063\u305f\u304b\u3089\u3067\u3057\u305f\u3002json\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u306a\u3063\u3066\u306a\u304b\u3063\u305f\u3001\u3001\u3001<\/p>\n<p>\u307e\u305a\u306fjson\u3063\u307d\u3044\u3082\u306e\u306e\u30c7\u30fc\u30bf\u578b\u3092\u78ba\u8a8d\u3057\u3088\u3046\u3068\u304a\u3082\u3063\u3066\u30c7\u30fc\u30bf\u578b\u3092\u78ba\u8a8d\u3059\u308b\u305f\u3081\u306etypeof\u3092\u4f7f\u3044\u307e\u3057\u305f\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u611f\u3058\u3002<\/p>\n<div class=\"pre_tag\"><span><i class=\"fa fa-code\"><\/i> \u30b3\u30fc\u30c9<\/span><\/p>\n<pre><code>console.log(typeof data);<\/code><\/pre>\n<\/div>\n<p>\u305d\u3057\u305f\u3089\u3001\u3070\u3063\u3061\u308astring\u3068\u8868\u793a\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n<p>\u306a\u306e\u3067\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u611f\u3058\u3067parse\u3057\u3066\u3042\u3052\u308b\u3068\u3001\u3001\u3001<\/p>\n<div class=\"pre_tag\"><span><i class=\"fa fa-code\"><\/i> \u30b3\u30fc\u30c9<\/span><\/p>\n<pre><code>Json.parse(data);\ncosole.log(typeof data);<\/code><\/pre>\n<\/div>\n<p>\u3070\u3063\u3061\u308aJson\u306b\u306a\u3063\u3066\u8fd4\u3063\u3066\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>\u3053\u308c\u306b\u6c17\u3065\u304f\u306e\u306b4\u6642\u9593\u3001\u3001\u3001<\/p>\n<p>\u304d\u3064\u3059\u304e\u308b\u3001\u3001\u3001<\/p>\n<p>\u306f\u307e\u3063\u3066\u3057\u307e\u3063\u305f\u7406\u7531\u306f\u3044\u304f\u3064\u3082\u3042\u3063\u3066\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u3082\u306e\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<ul>\n<li>\u4e00\u56de\u540c\u3058\u3088\u3046\u306a\u611f\u3058\u3067\u4f5c\u696d\u3057\u305f\u6642\u306f\u52d5\u3044\u3066\u3044\u305f\u304b\u3089<\/li>\n<li>CloudWatchLog\u3068\u304b\u3067\u307f\u305f\u6642\u306f\u3001Json\u307d\u3044\u611f\u3058\u306b\u3046\u307e\u304f\u898b\u305b\u3066\u304f\u308c\u3066\u305f\u304b\u3089<\/li>\n<li>online\u306eJson\u5f62\u5f0f\u306e\u30c1\u30a7\u30c3\u30af\u30c4\u30fc\u30eb\u306a\u3069\u3067\u3082\u5f62\u5f0f\u306b\u554f\u984c\u306a\u3044\u306a\u3069\u306e\u7d50\u679c\u304c\u51fa\u3066\u3044\u305f\u304b\u3089<\/li>\n<\/ul>\n<p>\u306f\u30fc\u3001\u6c17\u3092\u53d6\u308a\u76f4\u3057\u3066\u3001\u6b21\u884c\u304d\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0a\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; \u3010aws\u30fblambda\u3011lambda\u5185\u306ejson\u306e\u8981\u7d20\u306e\u5024\u304c\u306a\u305c\u304b\u53d6\u5f97\u3067\u304d\u305a\u30014\u6642\u9593\u3055\u307e\u3088\u3063\u305f\u8a71 \u7d50\u8ad6 json\u5f62\u5f0f\u306e\u30d5\u30a1\u30a4\u30eb\u3060\u3068\u601d\u3063\u3066\u3044\u305f\u3089\u3001json\u306e\u3088\u3046\u306a\u5f62\u3092\u3057\u305fstring\u3060\u3063\u305f Json.pars &#8230; <\/p>\n","protected":false},"author":1,"featured_media":8395,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[256],"tags":[],"class_list":{"0":"post-8393","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-it","8":"entry"},"_links":{"self":[{"href":"https:\/\/yumishin.com\/index.php?rest_route=\/wp\/v2\/posts\/8393","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/yumishin.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/yumishin.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/yumishin.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/yumishin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8393"}],"version-history":[{"count":2,"href":"https:\/\/yumishin.com\/index.php?rest_route=\/wp\/v2\/posts\/8393\/revisions"}],"predecessor-version":[{"id":8396,"href":"https:\/\/yumishin.com\/index.php?rest_route=\/wp\/v2\/posts\/8393\/revisions\/8396"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/yumishin.com\/index.php?rest_route=\/wp\/v2\/media\/8395"}],"wp:attachment":[{"href":"https:\/\/yumishin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8393"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/yumishin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8393"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/yumishin.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8393"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}