I want to access "email" element in wso2 , "25" and "26" are not fixed , can you please help ? thanks
{
"sending": {
"25": [
{
"email": "aa#hotmail.com",
"name": "jack"
}
],
"26": [
{
"email": "aa#hotmail.com",
"name": "jack"
},
{
"email": "aa#hotmail.com",
"name": "jack"
}
]
}
}
First, you need to take a look at JSONPath.
Are you going to get All the emails at once? then use:
<property expression="json-eval($.sending.*.[*].email)" name="emails"/>
else?
use #Shanaka Premarathna `s answer.
Try the following. The first expression will capture the first two email addresses and the second expression will capture the last email address.
<log>
<property expression="json-eval($.sending.*.[0].email)" name="email->1,2"/>
<property expression="json-eval($.sending.*.[1].email)" name="email->3"/>
</log>
Related
In Azure Data Factory, I'm attempting to add params to the body of a copy task (connected to a REST API post request as the source). I'm wanting to use dynamic content to do so, but I'm struggling trying to find the real solution for the proper nomenclature. Here's what I have so far.
copy task
dynamic content
{
"datatable":
{
"start":0,
"length": 10000,
"filters": [
{
"name": "Arrival Dates",
"start": "pipeline().parameters.pDate1",
"end": "pipeline().parameters.pDate2"
}
],
"sort": [
{
"name": "start_date",
"order": "ASC"
}
]
}
}
You'll notice that I've added params for dates. Is this the correct nomenclature for trying to add dynamic content? The autocorrect tried to add the # sign in the beginning of the code block, which will cause the entire thing to error out. I've tried adding it before each parameter, but that isn't actually reading the dynamic values either.
This is not correct. You need to use concat to concatenate the different variables. Something like this :
#concat('{ "datatable": { "start":0, "length": 10000, "filters": [ { "name": "Arrival Dates", "start": "',pipeline().parameters.pDate1,'", "end": "',pipeline().parameters.pDate2,'" } ], "sort": [ { "name": "start_date", "order": "ASC" } ] } }')
This is also documented in the SO question.
I have question, hav can I get name of intent from array like this?
[
{
"intent": "intent_1",
"confidence": 0.6298341751098633
},
{
"intent": "intent_2",
"confidence": 0.6175673961639405
},
{
"intent": "intent_3",
"confidence": 0.23323171436786652
},
{
"intent": "intent_4",
"confidence": 0.22574123442173005
}
]
I want to save in variable name "intent_2".
Provided that array is stored in context in my_array, you can get name of the first intent with expression like this: <? $my_array[0].intent ?>.
I want to use only XML to bind a list to the data of a JSON file.
Here is my code:
XML View:
<List
headerText="Positions"
items="{/Positions}">
<ObjectListItem
title="{positions>id}">
</ObjectListItem>
</List>
index.html
var oPositionsModel = new sap.ui.model.json.JSONModel();
oPositionsModel.loadData("model/Positions.json");
sap.ui.getCore().setModel(oPositionsModel);
model/Positions.json
{
"Positions": [
{
"id": 123456,
"article": "Abcde",
"amount": 12
},
{
"id": 654321,
"article": "Edcba",
"amount": 21
}
]
}
I can't see, what's wrong. But I get "no data" all the time.
There is nothing in the console saying there is a problem here.
Your binding for the title attribute is not correct. You want to bind it directly to the id attribute of Positions, no need to specify the model:
<List
headerText="Positions"
items="{/Positions}">
<ObjectListItem
title="{id}">
</ObjectListItem>
</List>
Working demo in JSBin
I have a very complex JSON and a snippet of it is below:
var designerJSON=
{
"nodes":
[
{
"NodeDefinition": {
"name": "Start",
"thumbnail": "Start.png",
"icon": "Start.png",
"info": "Entry point ",
"help": "Start point in your workflow.",
"workflow ": "Start",
"category": "Basic",
"ui": [
{
"label": "Entry point",
"category": "Help",
"componet": "label",
"type": "label"
}
]
},
"States": [
{
"start": "node1"
}
]
},.......
]
}
I would like to get the value of "start" in States. But I am stuck in the first step of entering into JSON. When I try
console.log(designerJSON["nodes"]);
I am getting Undefined.
I want the value of start. Wich is designerJSON["nodes"]["States"]["start"].
Can you help.
Thanks in advance
designerJSON["nodes"]["States"]["start"] won't do it.
designerJSON["nodes"] is a list, as is States, so you need to access individual items by index (or iteration).
In the example you have given you need to use this:
designerJSON['nodes'][0]['States'][0]['start']
or this (cleaner IMO):
designerJSON.nodes[0].States[0].start
You have an array in JSON.
instead of
designerJSON["nodes"]["States"]["start"]
use
designerJSON["nodes"][0]["States"][0]["start"]
ps. pay attention on how code is formatted in the topic.
pps. using brackets for accessing properties in js is "bad style" (due to js hint recommendations). better access those via dot, e.g:
designerJSON.nodes[0].States[0].start
I'm POST'ing the following JSON to asana's "tasks" endpoint.
{
"data": {
"options": {
"fields": [
"name",
"notes"
]
},
"workspace": <valid number>,
"assignee": <valid number>
}
}
It's giving me a "Invalid field" error every time. I've read through the API a few times now and this JOSN looks exactly how the API says it should. Any ideas?
Asana API for those of you who want to help out: Asana API Documentation
(I work for Asana)
The "options" field is a sibling of the "data" field, not a child. This is mentioned in the docs, but perhaps we aren't providing clarifying examples to make it more obvious.
If you change your request to look like this:
{
"options": {
"fields": [
"name",
"notes"
]
},
"data": {
"workspace": <valid number>,
"assignee": <valid number>
}
}
things should work.