Trying to generate a json asset file in Flutter - json

I have created a flutter web project and I am using flutter_azure_b2c package which uses asset json files, everything works fine when I run it.
it's shown like this
Now I want to generate these json config files automatically using env variables when I build the app.
Here is my json file format:
{
"client_id" : "",
"redirect_uri" : "",
"cache_location": "localStorage",
"interaction_mode": "redirect",
"authorities": [
{
"type": "B2C",
"authority_url":""
},
{
"type": "B2C",
"authority_url":""
}
],
"default_scopes": [
]
}
How can it be done?
I tried to write into the file when executing main.dart using this package https://pub.dev/packages/global_configuration but json values are not updated when I pass them in flutter_azure_b2c method

Related

Azure CLI Extensions: exported dashboard template.json "does not contain the property 'location'" error

I'm getting this error:
<_io.TextIOWrapper name='C:\\Users\\david\\source\\repos\\azurePortalInfrastruct\\ExportedTemplate-example-resources\\template.json' mode='r' encoding='cp1252'> does not contain the property 'location'
Which may be down to the way the template.json file has been put together.
My issue is similar to:
Azure CLI unable to create portal dashboards from templates
I followed this to a now closed github issue: Azure CLI unable to create portal dashboards from templates #16356
Following the advice from the developer. I used the following command (which generated the error):
az portal dashboard import --name "testDashboard" --resource-group "example-resources_copy" `
>> --input-path "C:\Users\david\source\repos\azurePortalInfrastruct\ExportedTemplate-example-resources\template.json"
The file template.json was exported from my portal. I have checked it. It has lines 13-16:
"type": "Microsoft.Portal/dashboards",
"apiVersion": "2020-09-01-preview",
"name": "[parameters('dashboards_a9dc12e1_3aae_431d_b935_81dd5ea20bd8_dashboard_name')]",
"location": "westus",
Regarding a similar command the developer has said:
In az portal dashboard create, the --input-path is the path to properties json file instead of full template.
My export from portal dashboard consisted of two files.
template.json
parameters.json
The file template.json contains a properties section on line 20 (which follows the location line 16) But I didn't get a separate properties.json file in my export.
The developer goes on to say:
If you want to create a dashboard with full template, should use the command az portal dashboard import. Also, you need to update the location value in your sample Json.
I can get it working with the sample json code sample used for the github issue #16356
{
"properties": {
"lenses": {
"0": {
"order": 0,
"parts": {}
}
},
"metadata": {
"model": {
"timeRange": {
"value": {
"relative": {
"duration": 24,
"timeUnit": 1
}
},
"type": "MsPortalFx.Composition.Configuration.ValueTypes.TimeRange"
}
}
}
},
"name": "TestDashboard",
"type": "Microsoft.Portal/dashboards",
"location": "westus",
"tags": {
"hidden-title": "My Test Dashboard"
},
"apiVersion": "2015-08-01-preview"
}
But this is sample is nothing like the JSON ARM code I exported from my existing Azure Portal dashboard.
Any suggestions appreciated.

How can I access this JSON data in flutter?

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.

Validate artifacts in JSON file using gradle

I have a JSOn file which contains some artifacts location as:
{
"contract_type": "jellybean",
"contract_version": "1.2",
"service_id": "8349a2b2-c1f8-11e5-9912-ba0be0483c18",
"dependencies": {
"maven": [
{
"group_id": "com.org.open.Download",
"artifact_id": "DownLoadSchema",
"version": "1.2.0-20160122190100",
"extension": "tgz"
},
{
"group_id": "com.org.open.softwarejson",
"artifact_id": "ApmUI",
"version": "1.2.0-20150122190100",
"extension": "json"
}
]
}
}
All the above artifacts are located in artifactory at location.
The requriement is to verify whether the artifacts listed in json file are present in artifactory location, and this has to be done using gradle.
I need some help with following steps:
How to downlaod the above json or how to get the list of artifacts without downloading the json file.
After json is available, how to parse and match the artifacts present in json to those present in artifactory location?

Parse.com File storage creating JSON with key:property - "__type":"File"

After downloading a parse Class, I found that it stores file type column as:
{ "results": [
{
"createdAt": "2015-10-27T15:06:37.324Z",
"file": {
"__type": "File",
"name": "uniqueidentifier1-filename.ext",
"url": "http://files.parsetfss.com/example-file-url.png"
},
"objectId": "8eBlOHHchQ",
"updatedAt": "2015-10-27T15:06:37.324Z"
},
{
"createdAt": "2015-10-27T14:35:02.853Z",
"file": {
"__type": "File",
"name": "uniqueidentifier2-filename.ext",
"url": "http://files.parsetfss.com/example-file-url.png"
},
"objectId": "B2tg7tBsHL",
"updatedAt": "2015-10-27T14:35:02.853Z"
}] }
For an app, I need to locally construct a JSON class like this and then manually upload it to the parse app. So I save the file first to parse and the get the file name and file url by file.url() and file.name() and then construct an object like this:
object.file.name = file.name();
object.file.url = file.url();
This works fine and sets the url and name keys as expected. However, after this if I do
object.file['__type'] = 'file'
the object.file object get converted into some weird parse file object and console.log(object) gives (notice the extra underscore and no __type key)
file: b.File
_name: "uniqueidentifier1-filename.ext"
_url: "http://files.parsetfss.com/example-file-url.png"
but console.log(object.file) gives properly
Object {url: "http://files.parsetfss.com/example-file-url.png", name: "uniqueidentifier1-filename.ext", __type: "File"}
saving the object in a text file also gives the same result as console.log(object). However, I want the text file to be similar to how parse actually stores it so that I can then upload the text file to a parse class.
In Javascript, call the toJSON() function on your PFObject which returns a JSON object suitable for saving on Parse.

Error with the JSON File while using scrapy for crawling

I am using a script, Financial-News-Crawler, that I found on GitHub using Scrapy. Basically this crawls the mentioned website. It uses a Json file where rules and paths are mentioned for the website to crawl. I had a look at the scrapy documentation in order to write the JSON file for my yahoo finance website. When I try to run the script it says "No json could be decoded."
Here is the structure of the .json file:
{
"allowed_domains" : [“finance.yahoo.com”],
"start_urls": [
"http://finance.yahoo.com/investing-news/"
],
"rules": [
{
"allow": [“/investing-news"],
"follow": true
},
],
"paths": {
"title" : ["//title/text()"],
"date" : ["//span[#class='datestamp']/text()"],
"text" : ["//div[#id=‘article_content’]”, "//div[#id='article_body']"]
},
"source": “finance yahoo“,
"company": “Yahoo”
}
What am I doing anything wrong?