Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add JsonToJsonl task #142

Open
anna-geller opened this issue Oct 11, 2024 · 2 comments
Open

Add JsonToJsonl task #142

anna-geller opened this issue Oct 11, 2024 · 2 comments
Labels
area/plugin Plugin-related issue or feature request enhancement New feature or request good first issue Great issue for new contributors kind/quick-win Seems to be quick to do

Comments

@anna-geller
Copy link
Member

Feature description

Too many users have to tediously do:

  - id: json_to_ion
    type: io.kestra.plugin.serdes.json.JsonToIon
    from: "{{ outputs.download.uri }}"
    newLine: false # regular json

  - id: ion_to_jsonl
    type: io.kestra.plugin.serdes.json.IonToJson
    from: "{{ outputs.json_to_ion.uri }}"
    newLine: true # JSON-L

Only to get from the JSON returned by a typical API to a JSON-L format needed by kestra tasks such as e.g. ForEachItem.

We should instead allow (without going through Ion):

  - id: json_to_jsonl
    type: io.kestra.plugin.serdes.json.JsonToJsonl
    from: "{{ outputs.download.uri }}"

full example showing the current state:

id: iterate_over_json
namespace: company.team

tasks:
  - id: download
    type: io.kestra.plugin.core.http.Download
    uri: "https://api.restful-api.dev/objects"
    contentType: application/json
    method: GET
    failOnEmptyResponse: true
    timeout: PT15S

  - id: json_to_ion
    type: io.kestra.plugin.serdes.json.JsonToIon
    from: "{{ outputs.download.uri }}"
    newLine: false # regular json

  - id: ion_to_jsonl
    type: io.kestra.plugin.serdes.json.IonToJson
    from: "{{ outputs.json_to_ion.uri }}"
    newLine: true # JSON-L

  - id: for_each_item
    type: io.kestra.plugin.core.flow.ForEachItem
    items: "{{ outputs.ion_to_jsonl.uri }}"
    batch:
      rows: 1
    namespace: company.team
    flowId: mysubflow
    wait: true
    transmitFailed: true
    inputs:
      json: "{{ json(read(taskrun.items)) }}"
@anna-geller anna-geller added enhancement New feature or request area/plugin Plugin-related issue or feature request good first issue Great issue for new contributors labels Oct 11, 2024
@kestrabot kestrabot bot added this to Issues Oct 11, 2024
@github-project-automation github-project-automation bot moved this to Backlog in Issues Oct 11, 2024
@sanskar9415
Copy link

sanskar9415 commented Oct 11, 2024

i would like to work on this issue, can u please assign this to me?

@anna-geller
Copy link
Member Author

@sanskar9415 any progress on this? :) unassigned for now but if you're working on this, let us know

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/plugin Plugin-related issue or feature request enhancement New feature or request good first issue Great issue for new contributors kind/quick-win Seems to be quick to do
Projects
Status: Backlog
Development

No branches or pull requests

2 participants