数値を含むテーブルがありますが、文字列として格納されているため、関数 parseFloat を使用して int のテーブルに変換しようとしています。ただし、 for ループをどのように実行しても、空のテーブルが表示されます。行を解析すると、単一の int が得られます。単一の int も解析できますが、行またはテーブルを解析できないようです。これが私がこれまでに持っているものです。これは、1行を変換しようとしているだけです。テーブル全体に対して 2 つの for ループを試しましたが、どちらもうまくいきませんでした。ありがとう。
var c =[];
var entries = $.parseJSON('<?php print(json_encode($try, true)); ?>');
for (var j = 0; j < 12; j++)
{
for (var i = 0; i < 7; i++)
{
c [j][i] = parseFloat(entries[j][i]);
}
}
alert(c);
ここにエントリがあります json エンコード [["-248","-163","-455","-1413","-1294","-1296","-1089"],["-172"," -219","-1186","-1368","-1480","-1079","-845"],["-98","-198","-703","-996" ,"-1100","-585","-616"],["-116","-241","-498","-642","-704","-354","- 430"]、["-137"、"-117"、"-264"、"-525"、"-533"、"-269"、"-476"]、["-12"、"87" ,"-257","-463","-551","-302","-535"],["170","61","-250","-472","-659" ,"-220","-605"],["159","96","-234","-513","-617","-196","-710"],["185","117" ,"-272","-521","-610","-258","-798"],["208","95","-234","-534","-696" ,"-280","-854"],["192","151","-188","-641","-739","-279","-957"],["249" ","223","-235","-684","-763","-339","-978"]]-798"],["208","95","-234","-534","-696","-280","-854"],["192","151"," -188","-641","-739","-279","-957"],["249","223","-235","-684","-763"," -339","-978"]]-798"],["208","95","-234","-534","-696","-280","-854"],["192","151"," -188","-641","-739","-279","-957"],["249","223","-235","-684","-763"," -339","-978"]]