json file transfer yaml

Installation package npm npm install -g json2yaml

After a successful installation can be viewed in packjson whether the installation is successful

Use document

In vue file import YAML from 'json2yaml';

Use this.data = YAML.stringify (this.data);

Note: The show to be displayed in the editor, vue available in the editor mavonEditor

Json data format is the object as shown below:

 

Guess you like

Origin www.cnblogs.com/xu-nian-qin/p/11417942.html