COMMUNITY

JSON without FileSystem

I’ve recently begun storing some of my data in a JSON file, but I’m confused on something. I’ve been using the FileSystem to read/write to my JSON file, and in the documentation, Sys (and therefore FileSystem) aren’t supported by the Javascript target. JSON, however, is available on all platforms. I assume this means that there is another way to read/write to the files, but I found nothing when I looked.

Thanks for any help.

You cannot access the filesystem from the javascript target no,
unless you target nodejs and use the hxnodejs library.

JSON has usages beside reading from files, you might need to parse the response of a web api, or send it json. You can also use JSON as serialization to store data in local storage.

You could also use the compiletime library to include your json file inside the javascript file.

Thank you for the clarification, hxnodejs seems to be what I was looking for.

You might want to take a look at: http://matthijskamstra.github.io/haxenode/

(disclaimer: I wrote that)