Comments (5)
@aku the Jackson library is in the classpath, you may be able to use it to process JSON.
from kestra.
Built in support for JSON is certainly welcome. In my case I was disappointed with Jython performance (I do a simple transformation of array of data which includes parsing JSON string) so I've decided to try other FileTranform tasks/plugins.
Nashorn doesn't support returning multiple rows, Groovy can't parse JSON. So I stuck with Jython
from kestra.
@aku the Jackson library is in the classpath, you may be able to use it to process JSON.
Hi @loicmathieu
Thanks! It took me a while to figure out how to use it but I managed to parse JSON objects using Jackson lib.
Here is a snippet:
import com.fasterxml.jackson.*
def jsonStr = '{ "name": "John Doe", "age": 99, "embedded": {"foo": "bar"} }';
def mapper = new databind.ObjectMapper();
def typeRef = new core.type.TypeReference<HashMap<String,Object>>() {};
data = mapper.readValue(jsonStr, typeRef);
logger.info('json object: {}', data);
logger.info('embedded field: {}', data.embedded.foo)
Maybe you can update plugin documentation to provide some examples for other users?
Also, it would be nice to know plugin's limitations
from kestra.
good catch, we'll get back to you on that on Monday
btw would this task be useful in your use case? we were thinking of adding support for JSONata #3148
from kestra.
Hey, I got the following response from the team: "In process (in JVM) script tasks will never be able to install any packages due to security reasons. They are more performant than scripts in external processes but with fewer features."
This means we are not able to install any external Groovy libraries including JSON. To use JSON packages, you will need to use Node.js or Python script task instead (or JSONata once we add it).
from kestra.
Related Issues (20)
- Prefilling execution with `null` inputs fills with 'null' as string
- Subflow attempts don't have a RUNNING state on the attempts
- Kafka trigger produces an error: Worker Evaluate Failed with error 'Cannot invoke "java.util.Optional.map(java.util.function.Function)" because "evaluate" is null'
- Unintended Dynamic Resizing of Chart on cluster monitor overview
- Dublication of Page title in Plugins
- Flow becomes unavailable after closing namespace file in editor HOT 2
- Documentation for io.kestra.plugin.core.trigger.Webhook is out of date
- Can't view files when Editor is selected to Topology View
- Add ability to restrict HTTP methods for io.kestra.plugin.core.trigger.Webhook
- Failed to obtain JDBC Connection HOT 2
- Saved files disappear from the editor when using S3 storage HOT 14
- Setting namespacedFiles.enabled to false in io.kestra.plugin.scripts.python.Script task throws NullPointerException exception HOT 3
- New editor keeps the previous opened namespace file even if I create a new flow
- Deprecated error doesn't explain what was replaced for `LocalFiles` and `docker`
- Issue with Escaping Curly Braces in YAML for Kestra HOT 2
- Fail a flow validation if a Pebble expression contains a `-` in a variable name
- io.kestra.plugin.core.flow.WaitFor: incorrect behaviour when using output of previous task
- Issue with Escaping Curly Braces in YAML for Kestra
- Support for secret files
- Kestra will go to > 80% CPU and 100% ram if secret in webhook trigger
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 kestra.