-
Notifications
You must be signed in to change notification settings - Fork 57
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 an optional value to -e #36
Comments
Is the index reliable |
That's what I've used as a workaround for now. It looks like, but since it's not under my control, I can't really rely on it. |
True. The problem with your suggestion is that "key=val" is a valid JSON string. {
"Outputs": [
{
"OutputValue": "value1",
"OutputKey=key2": "key1"
},
{
"OutputValue": "value2",
"OutputKey": "key2"
}
]
} And |
Yeah, i thought about that, but wasn't sure if it is. If you start escaping things, it gets tricky, not to mention backward compatibility. So maybe precede -e with -s (just like inserting)?
Or add an extra flag
|
Jshon is not really meant to be used that way. It is for safely extracting segments of json information. It can't do anything smart with the data. It passes off the heavy lifting to the standard text-processing tool chain. Generally the form would look something like
Or a trivial bit of Awk. Since this is a very small and contrived example I can't give you good advice. |
Well, I don't see how the suggested features isn't about "safely extracting segments of json". All I suggest is filtering a list of nodes by value instead of key. Admittedly, this might be considered a corner case, but a not too complicated one at that. Honestly though, I believe that everytime somebody uses awk for JSON or XML processing ... God kills a kitten. Seriously. :) |
I prefer the Given @sfussenegger's example, these calls would be similar:
and:
So |
Good idea. I'd love to see this select (kind of conditional) parameter |
This is the JSON snippet I'm working on (as returned by aws cli):
I want jshon to get the OutputValue where the OutputKey is 'key2'. 'value2' that is. Currently, I don't see a way to do this, so I'd like to suggest an optional value to the -e parameter:
jshon -e Outputs -a -e OutputKey=key2 -p -e OutputValue -u
The text was updated successfully, but these errors were encountered: