1
0

More than 1 year has passed since last update.

ACDLを提唱します。その2

Last updated at Posted at 2022-03-06

概要

ACDLとは、アプリは、クラウド、大切なデータは、ローカルです。
plunkerで、jsonを書き込み、読み込みしてみた。

サンプルコード

var line = {
  "maker": { 
     "name": "on" 
  },
  "genkin": {     
  }
};
var json = JSON.stringify(line); 
var blob = new Blob([json], { 
  type: "text/json" 
});
var url = URL.createObjectURL(blob);
document.getElementById("export").href = url;
var uploadFile;
document.getElementById('jsonFile').addEventListener("change", function() {
    var reader = new FileReader();
    reader.onload = function(e) {
      alert(e.target.result);        
      var data = JSON.parse(e.target.result);
      alert(data.maker.name);        
    };
    uploadFile = this.files[0];
    reader.readAsText(uploadFile);
}, true);
//alert("ok");




成果物

以上。

1
0
0

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
0