AngularJs json文字列をオブジェクトに変換fromJsonとオブジェクトをjson文字列toJsonに変換

33086 ワード

AngularJsでは、json形式の文字列をjson形式のオブジェクトに変換できます.コードは次のとおりです.
HTML 5の2つのローカルストレージ方式(localStorageとsessionStorage)を使用してテストを行います.01 var   m = angular.module( 'app' , []); 02 m.controller( 'ctrl' , [ '$scope' function ($scope){ 03      $scope.data = { 'name' : 'K`illCode ' }; 04      //window.localStorage.setItem('data', $scope.data); 05      //console.log(window.localStorage.getItem('data')); 06        07      window.sessionStorage.setItem( 'data' , angular.toJson($scope.data)); 08      console.log(angular.fromJson(window.sessionStorage.getItem( 'data' ))); 09      console.log(window.sessionStorage.getItem( 'data' )); 10 }]);
次に、jQueryフォームでコミットされた例を使用して、toJsonとfromJsonの使い方を説明します.
toJson:jsonオブジェクトをjson文字列に変換します.
fromJson:json文字列をjsonオブジェクトに変換します.
htmlおよびjsセクション:01 02 "en" > 03      < head > 04          "UTF-8" > 05          Document 06          "Keywords"   content= "" > 07          "Description"   content= "" > 08      head > 09      "app"   ng-controller= "ctrl" > 10         
"./5.php"   method= "post" > 11              12                  13                  type = "text"   name= "name"   ng-model= "blog.name"   ng-value= "blog.name"   /> 14              15              16                  17                  type = "text"   name= "url"   ng-model= "blog.url"   ng-value= "blog.url" /> 18              19              type = "text"   name= "data"   /> 20              {{blog.name}} 21              type = "submit"   /> 22          23      24 25 <code class="functions" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(255,20,147);">type</code><code class="plain" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(0,0,0);">=</code><code class="string" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:#0000FF;">"text/javascript"</code> <code class="plain" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(0,0,0);">src=</code><code class="string" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:#0000FF;">"../js/angular.min.js"</code><code class="plain" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(0,0,0);">> 26 <code class="functions" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(255,20,147);">type</code><code class="plain" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(0,0,0);">=</code><code class="string" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:#0000FF;">"text/javascript"</code> <code class="plain" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(0,0,0);">src=</code><code class="string" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:#0000FF;">"http://www.zymseo.com/js/demo.js"</code><code class="plain" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(0,0,0);">> 27 <code class="functions" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(255,20,147);">type</code><code class="plain" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(0,0,0);">=</code><code class="string" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:#0000FF;">"text/javascript"</code><code class="plain" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(0,0,0);">></code></td> </tr> </tbody> </table> </div> <div class="line alt2" style="border:0px;background:rgb(248,248,248) none;vertical-align:baseline;line-height:20px;min-height:auto;"> <table style="margin-left:0px;border-width:0px;background:none;vertical-align:baseline;line-height:20px;font-size:14px;min-height:auto;"> <tbody style="border:0px;background:none;vertical-align:baseline;line-height:20px;min-height:auto;"> <tr style="border:0px;background:none;vertical-align:baseline;line-height:20px;min-height:auto;"> <td class="number" style="border-width:0px;background:none;vertical-align:top;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(175,175,175);"><code style="border:0px;background:none;text-align:right;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;">28</code></td> <td class="content" style="line-height:25px;border-width:0px 0px 0px 3px;border-left-color:rgb(108,226,108);background:none;vertical-align:top;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(0,0,0);"><code class="plain" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(0,0,0);">var m = angular.module(</code><code class="string" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:#0000FF;">'app'</code><code class="plain" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(0,0,0);">, []);</code></td> </tr> </tbody> </table> </div> <div class="line alt1" style="border:0px;vertical-align:baseline;line-height:20px;min-height:auto;"> <table style="margin-left:0px;border-width:0px;background:none;vertical-align:baseline;line-height:20px;font-size:14px;min-height:auto;"> <tbody style="border:0px;background:none;vertical-align:baseline;line-height:20px;min-height:auto;"> <tr style="border:0px;background:none;vertical-align:baseline;line-height:20px;min-height:auto;"> <td class="number" style="border-width:0px;background:none;vertical-align:top;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(175,175,175);"><code style="border:0px;background:none;text-align:right;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;">29</code></td> <td class="content" style="line-height:25px;border-width:0px 0px 0px 3px;border-left-color:rgb(108,226,108);background:none;vertical-align:top;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(0,0,0);"><code class="plain" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(0,0,0);">m.controller(</code><code class="string" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:#0000FF;">'ctrl'</code><code class="plain" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(0,0,0);">, [</code><code class="string" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:#0000FF;">'$scope'</code><code class="plain" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(0,0,0);">, </code><code class="keyword" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-weight:bold;min-height:auto;color:rgb(0,102,153);">function</code><code class="plain" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(0,0,0);">($scope){</code></td> </tr> </tbody> </table> </div> <div class="line alt2" style="border:0px;background:rgb(248,248,248) none;vertical-align:baseline;line-height:20px;min-height:auto;"> <table style="margin-left:0px;border-width:0px;background:none;vertical-align:baseline;line-height:20px;font-size:14px;min-height:auto;"> <tbody style="border:0px;background:none;vertical-align:baseline;line-height:20px;min-height:auto;"> <tr style="border:0px;background:none;vertical-align:baseline;line-height:20px;min-height:auto;"> <td class="number" style="border-width:0px;background:none;vertical-align:top;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(175,175,175);"><code style="border:0px;background:none;text-align:right;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;">30</code></td> <td class="content" style="line-height:25px;border-width:0px 0px 0px 3px;border-left-color:rgb(108,226,108);background:none;vertical-align:top;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(0,0,0);"><code class="spaces" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;">    </code><code class="plain" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(0,0,0);">$scope.blog = {</code><code class="string" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:#0000FF;">'name'</code><code class="plain" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(0,0,0);">:</code><code class="string" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:#0000FF;">'K`illCode '</code><code class="plain" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(0,0,0);">, </code><code class="string" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:#0000FF;">'url'</code><code class="plain" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(0,0,0);">:</code><code class="string" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:#0000FF;">'http://blog.csdn.net/dome_'</code><code class="plain" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(0,0,0);">};</code></td> </tr> </tbody> </table> </div> <div class="line alt1" style="border:0px;vertical-align:baseline;line-height:20px;min-height:auto;"> <table style="margin-left:0px;border-width:0px;background:none;vertical-align:baseline;line-height:20px;font-size:14px;min-height:auto;"> <tbody style="border:0px;background:none;vertical-align:baseline;line-height:20px;min-height:auto;"> <tr style="border:0px;background:none;vertical-align:baseline;line-height:20px;min-height:auto;"> <td class="number" style="border-width:0px;background:none;vertical-align:top;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(175,175,175);"><code style="border:0px;background:none;text-align:right;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;">31</code></td> <td class="content" style="line-height:25px;border-width:0px 0px 0px 3px;border-left-color:rgb(108,226,108);background:none;vertical-align:top;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(0,0,0);"><code class="spaces" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;">    </code><code class="plain" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(0,0,0);">$(</code><code class="string" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:#0000FF;">'form'</code><code class="plain" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(0,0,0);">).submit(</code><code class="keyword" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-weight:bold;min-height:auto;color:rgb(0,102,153);">function</code><code class="plain" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(0,0,0);">(){</code></td> </tr> </tbody> </table> </div> <div class="line alt2" style="border:0px;background:rgb(248,248,248) none;vertical-align:baseline;line-height:20px;min-height:auto;"> <table style="margin-left:0px;border-width:0px;background:none;vertical-align:baseline;line-height:20px;font-size:14px;min-height:auto;"> <tbody style="border:0px;background:none;vertical-align:baseline;line-height:20px;min-height:auto;"> <tr style="border:0px;background:none;vertical-align:baseline;line-height:20px;min-height:auto;"> <td class="number" style="border-width:0px;background:none;vertical-align:top;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(175,175,175);"><code style="border:0px;background:none;text-align:right;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;">32</code></td> <td class="content" style="line-height:25px;border-width:0px 0px 0px 3px;border-left-color:rgb(108,226,108);background:none;vertical-align:top;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(0,0,0);"><code class="spaces" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;">        </code><code class="keyword" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;font-weight:bold;min-height:auto;color:rgb(0,102,153);">if</code><code class="plain" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(0,0,0);">($scope.blog.name!=</code><code class="string" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:#0000FF;">''</code> <code class="plain" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(0,0,0);">&& $scope.blog.url!=</code><code class="string" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:#0000FF;">''</code><code class="plain" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(0,0,0);">){</code></td> </tr> </tbody> </table> </div> <div class="line alt1" style="border:0px;vertical-align:baseline;line-height:20px;min-height:auto;"> <table style="margin-left:0px;border-width:0px;background:none;vertical-align:baseline;line-height:20px;font-size:14px;min-height:auto;"> <tbody style="border:0px;background:none;vertical-align:baseline;line-height:20px;min-height:auto;"> <tr style="border:0px;background:none;vertical-align:baseline;line-height:20px;min-height:auto;"> <td class="number" style="border-width:0px;background:none;vertical-align:top;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(175,175,175);"><code style="border:0px;background:none;text-align:right;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;">33</code></td> <td class="content" style="line-height:25px;border-width:0px 0px 0px 3px;border-left-color:rgb(108,226,108);background:none;vertical-align:top;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(0,0,0);"><code class="spaces" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;">            </code><code class="plain" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(0,0,0);">$(</code><code class="string" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:#0000FF;">'[name="data"]'</code><code class="plain" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(0,0,0);">).val(angular.toJson($scope.blog));</code></td> </tr> </tbody> </table> </div> <div class="line alt2" style="border:0px;background:rgb(248,248,248) none;vertical-align:baseline;line-height:20px;min-height:auto;"> <table style="margin-left:0px;border-width:0px;background:none;vertical-align:baseline;line-height:20px;font-size:14px;min-height:auto;"> <tbody style="border:0px;background:none;vertical-align:baseline;line-height:20px;min-height:auto;"> <tr style="border:0px;background:none;vertical-align:baseline;line-height:20px;min-height:auto;"> <td class="number" style="border-width:0px;background:none;vertical-align:top;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(175,175,175);"><code style="border:0px;background:none;text-align:right;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;">34</code></td> <td class="content" style="line-height:25px;border-width:0px 0px 0px 3px;border-left-color:rgb(108,226,108);background:none;vertical-align:top;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(0,0,0);"><code class="spaces" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;">        </code><code class="plain" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(0,0,0);">}</code></td> </tr> </tbody> </table> </div> <div class="line alt1" style="border:0px;vertical-align:baseline;line-height:20px;min-height:auto;"> <table style="margin-left:0px;border-width:0px;background:none;vertical-align:baseline;line-height:20px;font-size:14px;min-height:auto;"> <tbody style="border:0px;background:none;vertical-align:baseline;line-height:20px;min-height:auto;"> <tr style="border:0px;background:none;vertical-align:baseline;line-height:20px;min-height:auto;"> <td class="number" style="border-width:0px;background:none;vertical-align:top;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(175,175,175);"><code style="border:0px;background:none;text-align:right;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;">35</code></td> <td class="content" style="line-height:25px;border-width:0px 0px 0px 3px;border-left-color:rgb(108,226,108);background:none;vertical-align:top;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(0,0,0);"><code class="spaces" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;">    </code><code class="plain" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(0,0,0);">});</code></td> </tr> </tbody> </table> </div> <div class="line alt2" style="border:0px;background:rgb(248,248,248) none;vertical-align:baseline;line-height:20px;min-height:auto;"> <table style="margin-left:0px;border-width:0px;background:none;vertical-align:baseline;line-height:20px;font-size:14px;min-height:auto;"> <tbody style="border:0px;background:none;vertical-align:baseline;line-height:20px;min-height:auto;"> <tr style="border:0px;background:none;vertical-align:baseline;line-height:20px;min-height:auto;"> <td class="number" style="border-width:0px;background:none;vertical-align:top;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(175,175,175);"><code style="border:0px;background:none;text-align:right;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;">36</code></td> <td class="content" style="line-height:25px;border-width:0px 0px 0px 3px;border-left-color:rgb(108,226,108);background:none;vertical-align:top;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(0,0,0);"><code class="plain" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(0,0,0);">}]);</code></td> </tr> </tbody> </table> </div> <div class="line alt1" style="border:0px;vertical-align:baseline;line-height:20px;min-height:auto;"> <table style="margin-left:0px;border-width:0px;background:none;vertical-align:baseline;line-height:20px;font-size:14px;min-height:auto;"> <tbody style="border:0px;background:none;vertical-align:baseline;line-height:20px;min-height:auto;"> <tr style="border:0px;background:none;vertical-align:baseline;line-height:20px;min-height:auto;"> <td class="number" style="border-width:0px;background:none;vertical-align:top;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(175,175,175);"><code style="border:0px;background:none;text-align:right;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;">37</code></td> <td class="content" style="line-height:25px;border-width:0px 0px 0px 3px;border-left-color:rgb(108,226,108);background:none;vertical-align:top;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(0,0,0);"><code class="plain" style="border:0px;background:none;vertical-align:baseline;line-height:20px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;color:rgb(0,0,0);">
phpセクション:1 2      header( 'Content-type:text/html;charset="utf-8"' ); 3      var_dump( gettype ( $_POST [ 'data' ])); //string 4      var_dump(json_decode( $_POST [ 'data' ], true)); //array