AnsweredAssumed Answered


Question asked by CSMike_PDX on Jun 11, 2020
Latest reply on Jun 16, 2020 by CSMike_PDX

I'm attempting to read JSON from a configuration file using file.readAll().  I can open and perform the read, but can't figure out how to convert the ArrayBuffer to a string or ultimately I want to make use of the JSON in the file. 


Considering the file "foo.json" in my data folder:

     "name": "value",
     "things": []

I'm reading it using the following code:

    function readConfig() {
        var file = AppFramework.file(AppFramework.userHomePath + "/ArcGIS/Runtime/Data/foo.json");
        if (file.exists) {
            if ( {
                var data = file.readAll();
                // get the json?

but I can't seem to get the text or JSON from the binary data that readAll() returns.  It looks like I could use a loop and readLine() which returns a string, then check for file.atEnd, but it seems like there must be a better way.


Obviously I'm new on the QML/JS journey and would sure appreciate a push in the right direction.  Thanks in advance!