How can I access this JSON data in flutter? - json

I do know how to access json data. But this file is available to me not online but locally. So should I upload this JSON data file to firebase storage and access it from there? And one more thing, that how would I access data from this Json. Its formate is :
[
[
{
"nos": 0,
"name": "nnnnnnnasdfnnn",
"unique_id": "adfadfd",
"reg_details": [
{
"registered_with": "adfasdfasdf"
},
{
"type_of_ngo": "zzzzzzzz"
},
{
"registration_no": "zzzzzxxx"
},
Any example to access this kind of json data would be appriciated. Thanks

I was also stuck on this type of complex JSON. This article on Medium helped me.

Related

How to insert json data to sqflite table without clicking anything in app(Something like at first init of the app)

Can you help me with inserting ready json data that is stored in assets file to sqflite table.
And for example my json file
[
{
"word": "json",
"value": "format that uses human-readable text to store and transmit data "
},
{
"word": "life",
"value": "a gift"
},
{
"word": "work",
"value": "money"
}
]
and also at inserting that data to table, sqflite should add an another string for each key-value containing something like "inFavorite": "false".
so I've seen a lot of videos doing that in app, but not one that insert ready data to sqflite.
I would be grateful if you could help me!
Is that possible?
Thank you for your help!
I tried a lot of things but there is no result

Can we interchange JSON schema with YAML schema? or viceversa?

I have a device application which gets the data in JSON format. This JSON format is generated by another web based application using a YAML schema.
Now, as the web tool validates this JSON data file against the YAML schema, my device application also has to validate it against a schema. Since, the resource on my device is limited and we already have json schema validation in place, we are restricted to use schema in JSON format only.
So, my question is could we replace the YAML schema with JSON schema for the web tool? The web application has Swagger.
On another note, is there any existing script or open source tool to convert YAML schema to JSON schema?
Not sure about the OpenAPI definition. Its a simple schema file that will be used to validate JSON data. The JSON schema (draft v4) has below format. Our device application is in C++ language. Not sure about what is used in Web Tool, but it has some Swagger framework that generates the JSON data file for us.
{
"$schema": "https://json-schema.org/draft/2019-09/schema",
"definitions": {
...
"foobar_Result" : {
"type" : "object",
"properties" : {
"request" : {
"type" : "integer"
},
"success" : {
"type" : "boolean"
},
"payload" : {
"type" : "array", "items" : {"$ref" : "#/definitions/foobar_Parameter"}
}
},
"required" : ["request"],
"additionalProperties" : false
}
},
"$ref" : "#/definitions/foobar_Result"
}
If you are looking converting between API specification formats then this tool might help https://www.apimatic.io/transformer/

Azure Data Factory GetMetadata Activity

I have a metadata activity in one of my azure data factory pipeline and its connected to a data lake to get the files. Is there any method available in Azure data factory to sort the files available in the metadata activity based on the file name?
Sample output for the Metadata activity is given below
"childitems" :[
{
"name":"File_20200101.csv",
"type": "File"
},
{
"name":"File_20200501.csv",
"type": "File"
},
{
"name":"File_20200301.csv",
"type": "File"
},
{
"name":"File_20200201.csv",
"type": "File"
}
]
I need to get the files in the below-given order.
"childitems" :[
{
"name":"File_20200101.csv",
"type": "File"
},
{
"name":"File_20200201.csv",
"type": "File"
},
{
"name":"File_20200301.csv",
"type": "File"
},
{
"name":"File_20200501.csv",
"type": "File"
}
]
Regards,
sandeep
I have used a SQL server table to store the array values and then used a lookup activity with a order by file name query inside another loop to get the sorted filenames. This helped me to solve the sorting problem
Based on the GetMetadata Activity doc, no sort feature for childItems. So,i'm afraid you have to sort the childItemsby yourself.
In ADF environment,you could use Azure Function Activity after GetMetadata Activity.Pass the childItems as an array param into Azure Function.Inside azure function,it's easy to sort elements in an array by one element which is common requirement so that you could write code as you want.

converting one JSON structure into another JSON structure

The client side expects JSON string in the below format
descriptions": [
{
"lang": "string",
"size": "string",
"text": "string",
"type": "string"
}
],
, but the received JSON is a bit different - like below
"descriptions":{
"desc":[
{
"size":string,
"lang":"string",
"type":"string",
"content":"string"
}
]
},
Is there anyway to ignore the "desc" part - for eg. using a JSON annotation ? Context: I am passing this JSON through a REST API call and it will be automatically converted to a Java object at the receiving end.
A simple
descriptions = descriptions.desc;
will do.
You just construct the object you need:
var clientDescriptions = descriptions.desc.map(function(d) {
size: d.size,
type: d.type,
lang: d.lang,
content: d.text
});
If you are using Gson, it is possible to use custom JsonDeserializer / JsonSerializer for your Java model. Your model object and API can then be cleanly implemented without having to deal with the different json structures.
In my personal experience, the backend has a bug and must be solved, it mustn't be sending malformed data.In the long run it is the best solution.

Not being able to enter multiple comma seperated values in a column in database when sending a json request to the application

I know this is complex but please bear with me..........
I am building a Restful application. I have a specific requirement where there is a column named handle in my database. I need to store values like*(1,2,3,4)* in that column.
I am using spring mvc ,hibernate and eclipse as my IDE. I am also using PostMan Client. I read about hibernate spatial data type and i decided to go with that however i am not being able to store the data in database.
I have been sending a json request containing data to my application through postman client in order to save those data to database .However i am not being able to do this?? What is the problem??..
This is my Json
{
"operations": [
{
"operationType": 0,
"objectType": 2,
"data": {
"idNum": 212632034672,
"data": {
"radius": 80.11865321153431,
"strokeWidth": 5,
"stroke": "green"
},
"handle": {
"x": 223,
"y": 102
},
"parentId": 1
}
}
],
"projectGuid": "ff8081814521f6ce014521f7756f0000"
}
I know the problem lies in handle part but i have not been able to solve it.......
Following is part of my model:-
#Column(name = "handle",columnDefinition="Geometry")
#Type(type = "org.hibernate.spatial.GeometryType")
private Point handle;
P.S. I am using org.hibernatespatial.mysql.MySQLSpatialInnoDBDialect in my jpaContext.xml file and i already have hibernate-spatial-4.0.jar in my class path already