Unsolved Save/Load JSON using QML
-
Is that possible to Save/Load JSON data with only QML ??
Thanks
-
@Anas-A.-Ismail Yes but only from network as QML doesnot have direct access to local file system.
-
@p3c0 hmmm, may you pass me an example ?
-
I found an example here and the point discussed in this thread also.
kindly check them and let us know if you have any other thoughts.Thanks :)
-
@Anas-A.-Ismail Any Javascript JSON example would work. For eg. Use the AJAX code from here and put it inside a function in QML.
-
@p3c0 what the url should be if the files are on local file system ?
-
Try using the Qt.resolvedurl(..) to convert the local file system directory to upl and then give this as argument.
-
@Anas-A.-Ismail Since you want to save/load from local fs you will need to use C++. The link which you posted explains how to create a plugin and register it so as to use it from QML. The plugin will contain code to access local file as well as your other required functions.
-
Use these tools if you are working with JSON.
http://jsonformatter.org
http://codebeautify.org/jsonviewer