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

Allow JSON input via stdin #17

Open
LukasPrediger opened this issue Sep 30, 2021 · 2 comments
Open

Allow JSON input via stdin #17

LukasPrediger opened this issue Sep 30, 2021 · 2 comments

Comments

@LukasPrediger
Copy link

Allowing the json to be comming in from stdin would allow piped operations like consuming a kafka topic and validating all messages.

When no json file is specified, the program should read the standard input.

@neilpa
Copy link
Owner

neilpa commented Oct 1, 2021

Sounds reasonable to me. Probably also want to treat - as a positional argument to explicitly read from stdin.

The only thing I wonder about is YAML support in this mode. Right now yajsv relies on looking at the file extension to determine format. Maybe it's ok to just support JSON as a stdin reader though.

@joshqou
Copy link

joshqou commented Feb 5, 2022

Might be better to do a magic check against the first byte of the input, i.e: Assuming JSON input if the starting byte is {, [, or ". You could also add an --input-format flag or something so the format can be declared

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

No branches or pull requests

3 participants