ListView and Data Models - Blackberry - json

I'm developing for the Blackberry 10.
I'm attempting to save and load a JSON data model into a listview in my app. It loads up initially via a couple lines of C++ in the app.cpp file before switching control to the QML file. However, I don't know how to save new cells into this JSON database. I don't know how to reload the ListView after I save. Finally, I don't know the restrictions regarding what I can and cannot save in a JSON database. Can anyone offer some assistance? Should I even be using a JSON model or should it be a QML or even XML? Thanks for all your help.

Some more information about what you are doing here would be helpful in order to provide an answer. JSON is a format used to contain and represent objects in a string, it is not a database. Typically working with a ListView requires creating a ListModel that contains your data and is rendered by the ListView. When working with a ListModel you have access to a variety of functions as documented at http://harmattan-dev.nokia.com/docs/library/html/qt4/qml-listmodel.html . It is not clear from your question what you are actually doing though I would suggest posting your code to make everything clear.

Related

How to save data with JSON in a Xamarin app?

Good day dear developers, I really need your help. I want to make an app in Xamarin. In which I added some text data, and it is saved in this application. I need this information to be in the application, and I could get it without the Internet. I understand that you need to use JSON. I really want you to at least give a little hint on how I can store information using JSON in my Xamarin application. Thanks a lot!)
I tried to find information on Google, but there is a lot of superfluous and inappropriate
Depending on your data an easy way could be to use Preferences from Xamarin.Essentials which allows you to store key/value pairs: link to description
Another option would be to save files with JSON as you mentioned already. You create a class which holds your data and then serialize/deserialze the objects to files and from files. For this you can use the Newtonsoft.Json which is a nuget package that you can install.
If you have a MyData class and an data object it would look like this:
Serialize:
File.WriteAllText("fileName", JsonConvert.SerializeObject(data));
Deserialze:
var myData = JsonConvert.DeserializeObject<MyData>(File.ReadAllText("fileName"));
Different platforms has their own file system. For example, iOS limits our access to the file system, which is called Application sandbox. To save or load files, you could learn some basic info first:
for iOS, refer to File system access in Xamarin.iOS.
for Android, refer to File Storage and Access with Xamarin.Android
Xamarin forms provides several ways to use Xamarin forms local data storage. First is use File Handling just as Mario K mentioned. For Serializing JSON, you could refer to Serializing JSON.
Another is that you could use SQLite database engine which allows Xamarin.Forms applications to load and save data objects in shared code. More info, you could refer to Xamarin.Forms Local Databases.
I think you could first check these documentation and decide which method you prefer to use. If you still have questions, feel free to ask.
Hope it works for you.

Is there a way to automate creating a PyQt form using JSON schema?

I am working on a GUI (PyQt6) where the user loads some files and adds metadata for each. So for each file, I would like to have a window (QDialog) which is essentially a form with fields which are specified by a json schema.
I am new to PyQt and I can code the mechanism to open a form (QDialog with QLabels and QLineEdit which essentially looks like a form. see image). However, I would like to automatize this step using the schema that's stored in a json file (consider any example json schema).
Is there already a python library for this and I'm absolutely obvious about it?
How would you go about coding this? Thanks!

Extract JSON Data From ThingSpeak API

so i want to get the value from one oof my fields in my thingspeak, i'm able to extract data from my channels but i want to get only one specific field
i read the documentation and the api link that looks like this
https://api.thingspeak.com/channels/<channel_id>/feeds.json?results=1
and when i opened the link it showed this
{"channel":{"id":1688112,"name":"ESP8266 - Web Controlled LED","latitude":"0.0","longitude":"0.0","field1":"Command","field2":"Red LED","field3":"Green LED","field4":"Blue Led","created_at":"2022-03-29T00:36:06Z","updated_at":"2022-04-06T03:12:36Z","last_entry_id":443},"feeds":[{"created_at":"2022-04-10T07:06:01Z","entry_id":443,"field1":null,"field2":"0","field3":"0","field4":"0"}]}
so my question is how do i extract the data for example from my field2 data where "field2":"0"?
i want to use it for my project in my html where later it can do some functions in my content.
thanks!
It really depends on the program you use.
But usually you find a JSON library to be installed in your IDE.
With it you extract any field from the JSON file

GetOrgChart JSON format

A little startup I am doing work for is searching for a JavaScript Org Chart, and we believe we'd like to use "GetOrgChart" from getorgchart.com.
We definitely have a working back-end already that provides data to the front-end via RESTful services and provides JSON data.
We know the GetOrgChart can be loaded with data from various sources, and in this case we'd like to know what format the JSON has to be in?
Are there any examples out there of how the JSON should look like?
We'd definitely like to download and register this product, but that is one of the questions we'd like to get answered.
Thanks!
On their demos page, you can click the 'Get HTML Code' link (upper right, below the site header) which opens the javascript used to render the demo, including the format of the data.

Correct way of importing data from json in Ionic 2 using an interface

I'm really wondering what's the correct and best-practice way for importing data from a json file in an ionic 2 project so I can show it in a template, for example.
Some solutions I can find use interfaces, some don't. Some implement own small services, some don't. Some use http.get().map().subscribe(), some just use subscribe(). I would really like to know how to do this properly and would be glad if somebody could enlighten me.
From my view the best practice is to use a service and use http get request to get json file from your server. We did the same for getting language json file.
If you want securely get json file then you should put your json file at secure folder rather than public folder and create an api to get json file or json object from server.
Hope it will help