how to create json object using spreadsheet - json

I have a spreasheet which has some key value pairs like this:
how can i create a json object using this spreadsheet ?
enter image description here

Related

How to get the data in front end when API calling returning data in [[101,4],[102,2],[103,1],[104,1],[105,1],[108,1],[109,1]] without key value pair?

When I am calling API its giving data in [[101,4],[102,2],[103,1],[104,1],[105,1],[108,1],[109,1]] format which is only value. Is there any solution that how to get this data in UI in flutter?
Previously I have worked with below type of data coming from API.In this data can be accessed using key name but how to access value in [[101,4],[102,2],[103,1],[104,1],[105,1],[108,1],[109,1]] format when there is no key to access value in Flutter?
[{"activityId":101,"docId":90,"status":1},{"activityId":101,"docId":100,"status":0},{"activityId":101,"docId":159,"status":0},{"activityId":101,"docId":201,"status":0},{"activityId":1784,"docId":123,"status":1}]
This looks like basic List<List<int>> so if data is [[101,4],[102,2],[103,1],[104,1],[105,1],[108,1],[109,1]] let's say you want to access number 4 from the start of the message you'd need to access it like:
final response = <List<int>> [[101,4],[102,2],[103,1],[104,1],[105,1],[108,1],[109,1]]
int four = response[0][1];
print('$four')
in terminal would print value 4

Select id from JSON

I'm currently designing an app to display some attributes of products I have in a pricelist which is stored in a Google Sheets spreadsheet and I want it to get that data and show it
I have a google script which extracts all the data from the spreadsheet and returns a JSON. It's published as a web app and stored in a non visible component "Web1"
What I don't know how to do is to work with that JSON and select a particular row based on an ID that I get from a barcode scanner
I want it to work like this:
Get a result from the barcode reader
Display the result from the barcode scan in a textbox "Código de barras"
Use that result to filter from a JSON which is extracted from the spreadsheet
Display the JSON attribute "name" in the textbox "Producto"
I currently have this:
The web component works asynchronously, which means, first send the Get request and after having received the response in the GotText event, then do the further processing.

Bonita bmp 7 : bind JSON data to table

I'm a new in Bonita bpm. I receive data from my connector in the form as a json string.
There is like connector output param. I store this param like pool variable.
Then, i get this value with external api:
../API/bpm/activityVariable/{{taskId}}/response_rows[enter image description here][1]
I got json array like :
[{"reason":"reason","createdBy":"4","endDate":"2018-11-23T00:00:00+0000","persistenceId":"1","isApproved":"false","persistenceVersion":"0","startDate":"2018-11-15T00:00:00+0000","createtionDate":"2018-11-21T05:56:02+0000"},{"reason":"reason","createdBy":"4","endDate":"2018-11-23T00:00:00+0000","persistenceId":"2","isApproved":"false","persistenceVersion":"0","startDate":"2018-11-16T00:00:00+0000","createtionDate":"2018-11-21T06:01:26+0000"},{"reason":"test","createdBy":"4","endDate":"2018-11-16T00:00:00+0000","persistenceId":"3","isApproved":"false","persistenceVersion":"0","startDate":"2018-11-16T00:00:00+0000","createtionDate":"2018-11-21T07:26:57+0000"},{"reason":"reason","createdBy":"4","endDate":"2018-11-23T00:00:00+0000","persistenceId":"33","isApproved":"false","persistenceVersion":"0","startDate":"2018-11-22T00:00:00+0000","createtionDate":"2018-11-21T13:25:35+0000"},{"reason":"1111","createdBy":"4","endDate":"2018-11-17T00:00:00+0000","persistenceId":"34","isApproved":"false","persistenceVersion":"0","startDate":"2018-11-17T00:00:00+0000","createtionDate":"2018-11-21T13:26:58+0000"},{"reason":"rrr","createdBy":"4","endDate":"2018-11-30T00:00:00+0000","persistenceId":"35","isApproved":"false","persistenceVersion":"0","startDate":"2018-11-09T00:00:00+0000","createtionDate":"2018-11-21T13:29:37+0000"}]
I can create json variable from this json and set it as a data source.
I see that everything works fine. But when I set the data as External API variable nothing is displayed in the table.
I use the expression of my variable and not a constant (a small button in the content setting).
How can I show json array as a table ? Is it posiible ?
You can alternately save the API URL as a String Variable
return '../API/bpm/activityVariable/' + $data.taskId + '/response_rows[enter image description here][1]';
and use it as URL expression or variable.

How to get values in this json object in ext js?

I try to get values and put in a textfield. return json is ;
Object { info=[1]}
in this
info[Object { name="name", another ="another"}]
clearly ;
{"info":[{"name":"name","another":"another"}]}
i do ;
var resp = Ext.decode(response.responseText);
txtName.setValue(resp.info);
and in text field it shown [Object object]
How to i get name and another values?
Because response.info is a root level node in your response which contains an array of objects:
[{"name":"name","another":"another"}]
So to use a value from this object in the text box (as it needs a string value) you need to access the object in this array and then extract the value from whichever key you want so to get the name value in the text field you would use:
txtName.setValue(resp.info[0].name);
As a side note, usually you would use an ExtJS Store with a proxy configured to retrieve and store data from the server (if returned in this type of JSON like structure). On the store config you would configure the root property to the tell the store reader which named property in the response contains the data. So in this case 'info' is the root where your data can then be found. The store reader would then loop through the objects in the array and create records for each in the store for the rest of the application to use.

Mapping json field with database table field

How can a json id and database table id be mapped in ruby on rails and the output of the result be shown on UI. I have a collection of entries in my database say for id, name, url, code, and on UI i have implemented a table whose values are from Json field. I need to fetch data from database for url and code on UI using map concepts in rails.
Example :
Json field : [position":"1","name":"Bitcoin","change24":"-2.59 %","currency":"usd","id":"btc"]. My database has url and id, where id is the same value as in json. All thats needed is to map the id in-order to get the corresponding url on UI.
So is this something you are going for?
#json_data.map! do |json_item|
db_item = #database_data.detect{|dbi| dbi['id']==json_item['id']}
json_item['url'] = db_item['url'] if db_item
end