Skip to content

Conversation

@anzarwani
Copy link

Added JSON connector as an enhancement.
Testing is pending as I am facing some issues with module loading, will fix it soon.

@theweaklink
Copy link
Contributor

Hi Anzarwani,

awesome to have a PR for a new element! And thanks for making it similar to existing input elements. We haven't put much guidance on PR yet but it's very close from the start, well done!

I will start the code review comments but in the meantime, here some points to consider:

  • does this element require to be "dynamic", i-e other elements (such as dropdown) would depend on it through expressions?
    • if not, then it's probably easier to use pd.read_json(file_input(...)) that would avoid the new element and allows you to get your app right away on the Cloud.
    • if dynamic is expected, would you mind showing a use case with a small code snippet/example?
  • for dynamic elements, to be processed on OneCode Cloud, it requires a specific handling there, the initial thought was through metadata() but it is not completely the case yet => just beware that there would be some time required on our end before deploying the dynamic processor on the Cloud.

Thanks for any answer you can share.

* `IMAGE` :octicons-arrow-both-24: `("Image", ".jpg .png .jpeg")`
* `ZIP` :octicons-arrow-both-24: `("ZIP", ".zip .gz .tar.gz .7z")`
* `JSON` :octicons-arrow-both-24: `("JSON", ".json")`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra blank line to be removed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

causes flake8 error:
onecode/base/enums.py:126:1: W293 blank line contains whitespace

from ..input_element import InputElement


class JSONReader(InputElement):
Copy link
Contributor

@theweaklink theweaklink Oct 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you be ok renaming the component to JsonTableReader or JsonRowReader or similar?
The expected JSON is a table-like which is a subset of the variety of JSON. I am afraid JSONReader would be misleading in the sense it would tackle any JSON (even non-table-like).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi

Sorry I had been busy with production issues at work. Please give me some time, I will walk through the comments and the code, and accordingly update you here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no worries and no rush :)
whenever it's a good time for you

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this file is only necessary if there are emulations tests. I would either drop it, or add emulations test (the former being easier ;-))

@theweaklink
Copy link
Contributor

theweaklink commented Oct 10, 2025

Some comments related to failing CI:

  • Elements must be Camel Case so JSONReader => JsonReader but following comment here => suggestion is JsonTableReader or JsonRowReader
  • Need to add a new entry to the changelog MD
  • Flake8 error

Thanks a lot for the PR, let me know what you think about all the comments.
cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants