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

Wrap json-iterate output like array #7

Open
noway opened this issue Jun 18, 2014 · 3 comments
Open

Wrap json-iterate output like array #7

noway opened this issue Jun 18, 2014 · 3 comments

Comments

@noway
Copy link
Collaborator

noway commented Jun 18, 2014

Current json-iterate output:

echo '[1,2,3,4]'| ./json-iterate -j echo {}
{"returncode": 0, "stderr": "", "stdout": "1\n"}
{"returncode": 0, "stderr": "", "stdout": "2\n"}
{"returncode": 0, "stderr": "", "stdout": "3\n"}
{"returncode": 0, "stderr": "", "stdout": "4\n"}

Proposal:

echo '[1,2,3,4]'| ./json-iterate -j echo {}
[{"returncode": 0, "stderr": "", "stdout": "1\n"},
{"returncode": 0, "stderr": "", "stdout": "2\n"},
{"returncode": 0, "stderr": "", "stdout": "3\n"},
{"returncode": 0, "stderr": "", "stdout": "4\n"}]
@amarao
Copy link
Owner

amarao commented Jun 18, 2014

I can do this, but it more about other idea - to accept such 'stacked json' as valid input. The problem is that if application terminates unexpectedly, in case of array, it will leave invalid json. Moreover, there is a lot of problems with normal 'grep-like' operations.

I really like to keep compatibility with current type of shell line-based processing.

I think whole thing is about input, not output - we should be able to take as valid input those things:

[
"1",
"2",
"3",
]

[
"1",
"2",

"2",
"3"
]

"1"
"2"
"3"

I see how tricky it's gonna be, but it's absolutely necessary to allow relaxed input - else it's gonna be very unfriendly to user, who gonna be forced to 'hacks' around pipe just to satisfy inputs.

@noway
Copy link
Collaborator Author

noway commented Jun 18, 2014

Hm, your arguments convinced me. Okay then.

Leaving this issue open for future discussion, anyway.

@amarao
Copy link
Owner

amarao commented Jun 18, 2014

Yep, I'll change output to full json (just need to find way how to generate output steady). I think, it's gonna be clear after I repeat my experiments with JSONStreams

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

2 participants