Comments (6)
The data under total is not a map but and array with a single map element, so you must access the array item by its index. This should work: {{/result/total[0]/qty}}
from eel.
Yes, in a situation like this you can also pull an array element by key-value-pair present in the element. The syntax works like this: {{/result/total[assetref=18-265-55833]/qty}}
from eel.
Do you have a specific example? eval() lets you select maps, arrays and simple types from json documents. Example of a single value selection:
{{eval('/foo','{"foo":"bar"}')}}
from eel.
This is my case:
"Transformation": {
"{{/result}}" : "{{eval('/result/total/qty','{{prop('noderesponse')}}')}}",
"{{/error}}" : "{{eval('/error','{{prop('noderesponse')}}')}}",
"{{/id}}" : "{{eval('/id','{{prop('noderesponse')}}')}}",
"{{/check}}" : "{{eval('/','{{prop('noderesponse')}}')}}"
},
Response:
{
"check":{
"error": null,
"id": null,
"result":{
"1Gcv7PgJX8kg2zd6SMYq2shotah9H94r7bc61s":[
{"assetref": "18-265-55833", "name": "RURT", "qty": 94}
],
"total":[
{"assetref": "18-265-55833", "name": "RURT", "qty": 94}
]
}
},
"error": "",
"id": "",
"result": ""
}
The problem: eval does not return a single value (or maybe I am doing it the wrong way)
from eel.
P.S. Maybe it was a bit unclear, but I need "total" quantity ("qty") from where "assetref":"18-265-55833"
from eel.
Thanks, that really works. But I am not sure it has index [0], is there any way to get an item with "assetref":"18-265-55833" exactly ?
from eel.
Related Issues (20)
- Engraved in code transformation. HOT 3
- Unmatched quotes in jtp/inproc.go:127 HOT 1
- Remove object from every response HOT 5
- How-to questions on submitting pull-requests HOT 1
- Docker build error HOT 1
- Insert root element into an array
- fatal error: concurrent map iteration and map write
- -config flag listed as optional, is actually required HOT 2
- Add travis ci support HOT 1
- Event handler should return 202 instead of 200 HOT 1
- Need help on both request & responce transformation HOT 1
- Headers problem HOT 3
- How to use multiple "curl"s correctly ? HOT 3
- Is there such thing as "try..catch" ? HOT 1
- One handler or many handlers ?
- Multiple elements arrays howto ? HOT 1
- SSL support HOT 1
- Alphabet sorting enable/disable ? HOT 1
- How to extract
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eel.