Tip: Try out raw output with -r for simple key/value output #89
kellyjonbrazil
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
jc
provides a raw output option with the-r
cli flag, or with theraw=True
parse()
function argument. A couple parsers provide substantially different output if it is used and may work out better for your use case.For example, the
env
parser turns each environment variable into its own JSON object and adds all of these objects to a list:This output makes it easy to iterate over each key/value pair and match values to predictable key names. But if you don't need that format, try the
-r
flag:With this output there is no list to iterate - If you know the name of the key, you can quickly get the value.
The
history
parser has a similar default vs. raw behavior.For other parsers, the raw option will simply turn off additional processing, including converting known integers, floats, booleans, etc. according to the documented schema. The raw option will also suppress additional calculated fields from being output. This is typically useful for troubleshooting purposes but the raw output may be better suited to your particular use case in some scenarios.
Happy parsing!
Beta Was this translation helpful? Give feedback.
All reactions