![]() This way, you can move the header handling, parsing and perhaps filtering to your JSON aware tool. ![]() | select(.active = "true") | | active been a boolean field instead of a string field, this would be even shorter: curl. All headers as JSON As dealing with formatted data in the form of JSON has become very popular, I want to help fertilize this by making curl able to output all response headers as a JSON object. You didn't ask for this, but it would be easy to extract all the entries that have active set to the string true: curl. Built-in JSON support Forms and file uploads HTTPS, proxies, and authentication Arbitrary request data Custom headers Persistent sessions wget -like downloads See all features Examples Hello World: https httpie.io/hello Custom HTTP method, HTTP headers and JSON data: http PUT pie. Would you want your output delimited by a comma and a space instead, then replace with join(", "), or with if you require fully CSV-formatted data with quoted fields. Given the example data in the question, this would return 1.2.3.4 test Note that the specific formatting of the input JSON document is not important since none of the whitespace (newlines, indentation etc.) between keys and values matter. These would then be formatted as a tab-delimited list. cURL is a way you can hit a URL from your code to get a HTML response from it. | | would extract the values of the ip and type keys for each element in the list returned from curl. ![]() The command is designed to work without user interaction. When you have access to jq (available as a static binary from ), this task will be solved by curl. curl is a tool to transfer data from or to a server, using one of the supported protocols (DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET and TFTP).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |