Cocos Creator js Read, Write File like (plist or xml, json)?

Cocos Creator js Read, Write File like (plist or xml, json)?

I looked in cocos creator document and I don’t find any clue about CRUD file.
The reason i asking this, because i have define my game data structure in plist file, it such a big data structure and complicated, So do anybody have ideas about that stuff?
please kindly response I really need help for this.

The most pragmatic thing to do would be to define how you want your objects to look as you use them. Then define a javascript object to hold data in that structure, place it in a standalone .js file - which you access by going

var myData = require('mydata');

thank for reply.
You mean I need to implement standalone js code to work with that data file. if so, do they work on native build. I still worried about it.

You can read a json file like so
cc.loader.loadRes('SomeDirInResources/SomeJsonFile', (err, res) => this.parseData(err, res));
The file loaded needs to be referenced without extension.
For JSON files it just works but I don’t know what happens if you load a plist.

I use JSON files ro define everything in my game. Works great.
It would awesome if we also had a way to write JSON files (dont like to deal with localstorage…)

Is there a way to write JSON files in cocos creator? I am trying to maintain a config file for the client for our game and want to know how to write to a text file. I tried :

jsb.fileUtils.writeStringToFile(message, outputFileNameWithExtension);

but the above writes to a file in some obscure subfolder of the app folder of my Mac. I would like to save to the resources folder, or for that matter anywhere in my assets folder.

please help.