简体   繁体   English

是否可以使用前端JavaScript编写JSON文件?

[英]Is it possible to write a JSON file using front end JavaScript?

I am learning Javascript and working at frontend only. 我正在学习Javascript,并且仅在前端工作。 I want to write a JSON file using javascript and read it. 我想使用javascript编写JSON文件并读取它。 I know how to read it but don't know how to write it with frontend javascript. 我知道如何阅读,但不知道如何使用前端javascript编写。

To my best knowledge writing to the file system is against front-end development. 据我所知,写入文件系统不利于前端开发。 I suggest two options: 我建议两个选择:

  1. use cookie/localstorage 使用Cookie /本地存储
  2. download the file 下载文件

I would go about the first option 我会去第一个选择

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM