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

feat: add Parse JSON component #3167

Merged
merged 5 commits into from
Sep 3, 2024

Conversation

nicoloboschi
Copy link
Contributor

Added ParseJSON component that gets Data or Message and uses jq query to extract fields

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request size:M This PR changes 30-99 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Aug 2, 2024
Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-3167.dmtpw4p5recq1.amplifyapp.com

from langflow.io import Output
from langflow.schema import Data
from langflow.schema.message import Message
import jq
Copy link
Contributor

Choose a reason for hiding this comment

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

Does jq work on Windows?

Copy link
Contributor Author

@nicoloboschi nicoloboschi Aug 2, 2024

Choose a reason for hiding this comment

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

yeah pip should take care of it
https://pypi.org/project/jq/

Let me add the dependency explictly

if len(to_filter):
try:
to_filter = [json.loads(str(f)) for f in to_filter]
except:

Choose a reason for hiding this comment

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

should this be except JSONDecodeError ?

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Aug 19, 2024
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Aug 28, 2024
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Sep 3, 2024
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Sep 3, 2024
@ogabrielluiz ogabrielluiz enabled auto-merge (squash) September 3, 2024 16:28
@ogabrielluiz ogabrielluiz merged commit 1c7ef6e into langflow-ai:main Sep 3, 2024
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants