Comments (17)
The Windows build failed for now.
@Destroy666x windows build works now.
from obs-urlsource.
It's "Output Template" that's being rendered, right? First suggestion would be to turn that into a TextEdit textbox then. As from what I see inja loops have multiline syntax.
Another thing is how things are passed into the engine - e.g. array of objects seems to be text.
from obs-urlsource.
implemented in #39
from obs-urlsource.
@royshil example is like mentioned above:
- https://api.api-ninjas.com/v1/facts?limit=10 - requires API key, output is something like:
[
{
"fact": "something"
},
{
"fact": "else"
}
]
- JSON path:
$[*].fact
body
is for whole JSON output as the result is the same for the JSON path above and also for $
(root), even though results are different. Is there any way to have the JSON Path output as body
or another variable? I don't think it's possible but I may have missed something.
I'd like to feed the result of that JSON Path to {{ join(body, " | ") }}
as body
from obs-urlsource.
i think if i use https://github.com/pantor/inja it will enable everything and more
you can use loops and expressions in the {{ .. }}
from obs-urlsource.
Sounds good
from obs-urlsource.
implemented inja in #39
from obs-urlsource.
The Windows build failed for now.
from obs-urlsource.
i can just send the whole parsed response (in case of JSON) and you can use inja to manipulate it as you wish
from obs-urlsource.
Not sure about parsed response and how well Inja supports getting data out of it, but whole object/array would be nice for sure.
from obs-urlsource.
Any examples of how to do it with let's say this kind of JSON:
[
{
"something": "something"
},
{
"something": "else"
}
]
?
And format it as something | else | ...
Not too sure how it was solved in the end looking at source.
from obs-urlsource.
Example:
- https://api.api-ninjas.com/v1/facts?limit=10
- JSON path:
$
{{output}}
results in:
[{"fact":"..."},{...}]
kind of output.
I'd expect:
{% for fact in output %}
{{fact.fact}}
{% endfor %}
to cycle it, but I can't reall get it or anything similar to work. Also with body
instead of output
.
from obs-urlsource.
Ok, nvm, e.g.
{% for fact in body %}
{{fact.fact}} |||||
{% endfor %}
is in fact working, but it's not fully stable, as I had to hide and show the source for it to be displayes, otherwise it just showed as is. Not too sure what's going on. But I think it's more of a problem with coming back to working state after inja errors out so I'll create a new bug and'll close this as finished.
from obs-urlsource.
I guess there's one more question. With the example above, if I use:
$[*].fact
body
doesn't seem to change compared to $
, it's still just the whole JSON. Is there any way to access that specific JSON path as an array or object specifically, just like body
? So that you could use e.g. {{ join(array, " | ") }}
from obs-urlsource.
@royshil impossible, I assume?
from obs-urlsource.
@Destroy666x i'm not fully following you
can you provide a worked example? e.g. with the JSON body and the desired output?
from obs-urlsource.
@Destroy666x let's take this to another clean issue
just copy-paste plz
from obs-urlsource.
Related Issues (20)
- Unable to return the the table correctly from response body HOT 3
- OAuth2 support
- Crashed and Made OBS Unusable HOT 7
- OBS Crashed When Close HOT 2
- Parsed outputs are cut off if too many HOT 2
- issue when setting properties for the API plugin : HOT 1
- Save current output into a setting/property HOT 1
- inja templating {{input}} not working HOT 18
- Special characters URL not rendering on "Output is an image URL"
- Output to multiple sources HOT 9
- Not working with multiple updating objects HOT 4
- Add a way to Add icon images to the Plugin HOT 2
- Settings don't update when set via a WebSocket request HOT 2
- {{Input}} = Invalid URL? HOT 6
- Output is image option not working with animated gifs HOT 2
- Version compatible with MacOS Catalina (10.15.7) HOT 1
- Output entries in wrong order HOT 1
- Key/Value format .txt file Preset/Format? HOT 6
- Feature request: .csv files HOT 3
- Post body format for Laravel API HOT 3
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 obs-urlsource.