{"id":13494481,"url":"https://github.com/mislav/gorgeous","last_synced_at":"2025-04-09T14:15:48.925Z","repository":{"id":56874987,"uuid":"1350553","full_name":"mislav/gorgeous","owner":"mislav","description":"Convert between different data formats: JSON, XML, YAML, Ruby, email, URL-encoded","archived":false,"fork":false,"pushed_at":"2014-03-09T23:51:57.000Z","size":119,"stargazers_count":95,"open_issues_count":1,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-02T20:57:58.318Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mislav.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-02-10T12:54:41.000Z","updated_at":"2025-01-03T06:41:38.000Z","dependencies_parsed_at":"2022-08-20T10:11:13.971Z","dependency_job_id":null,"html_url":"https://github.com/mislav/gorgeous","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mislav%2Fgorgeous","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mislav%2Fgorgeous/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mislav%2Fgorgeous/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mislav%2Fgorgeous/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mislav","download_url":"https://codeload.github.com/mislav/gorgeous/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248054194,"owners_count":21039952,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T19:01:25.440Z","updated_at":"2025-04-09T14:15:48.889Z","avatar_url":"https://github.com/mislav.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"# Filthy → gorgeous\n\nConvert between formats.\n\nUsage:\n\n    gorgeous [-i] [-F \u003cin-format\u003e] [-T \u003cout-format\u003e] [-q \u003cquery\u003e] [-o \u003cdestination\u003e] FILE ...\n\nThis utility converts data between different formats.  \nFormats are one of:  json, xml, yaml, ruby, email, url\n\nInput can be read from STDIN as well as files given on the command-line.\n\nOptions:\n\n    -i    Convert file in-place\n    -F    Input format\n    -T    Output format\n    -q    Query selector in format similar to XPath (see below)\n    -o    Write output to file instead of STDOUT\n\nQuery format:\n\n    \"/items/comments[1]/text\"    --  2nd comment body of each item\n    \"/items[-1]/user/full_name\"  --  name of user for last item\n    \"//user/username\"            --  usernames of all users anywhere in the document\n\n## Prerequisites\n\nIt's recommended that you install all of these ruby libraries. They are only loaded when processing specific formats.\n\n* **nokogiri** for HTML/XML\n* **yajl-ruby** or **json** for JSON (for Ruby \u003c 1.9)\n* **activesupport** (for various stuff)\n* **rack** for url\n* **mail** for email\n\nAll together now:\n\n    $ gem install nokogiri yajl-ruby activesupport rack mail\n\n## Examples\n\nPipe in standard input:\n\n    # auto-detects input as being JSON, displays prettified output:\n    $ curl -s api.twitter.com/1/statuses/show/40453487309361153.json | gorgeous\n    \n    # covert from JSON to YAML\n    $ curl -s \u003curl\u003e | gorgeous -T yaml\n    \n    # extract Twitter avatar from tweet as text\n    $ curl -s \u003curl\u003e | gorgeous -T txt -q /user/profile_image_url\n\nPrettify a file in place:\n\n    # auto-detects format by extension, prettifies and overwrites the file:\n    $ gorgeous -i some-data.json\n    \n    # convert some data to YAML\n    $ gorgeous -i -F json -T yaml some-data\n\nPrettify some HTML (gorgeous calls it \"xml\"):\n\n    $ curl -s www.1112.net/lastpage.html | gorgeous -F xml\n\nPrettify content in clipboard (on a Mac):\n\n    $ pbpaste | gorgeous | pbcopy\n\n    # convert from YAML to ruby format and copy to clipboard\n    $ gorgeous fixture.yml -T ruby | pbcopy\n\nParse query strings and URL-encoded POST payloads:\n\n    $ echo 'sourceid=chrome\u0026ie=UTF-8\u0026q=filthy+gorgeous' | gorgeous -T yaml\n    --- \n    sourceid: chrome\n    q: filthy gorgeous\n    ie: UTF-8\n\nParse emails:\n\n    # extract prettified HTML part of the email:\n    $ cat email.raw | gorgeous -F email -T xml\n\n    # extract decoded text part of the email:\n    $ cat email.raw | gorgeous -F email -T txt\n\n    # get email headers as JSON:\n    $ cat email.raw | gorgeous -F email -T json\n\n    # get only the email subject:\n    $ cat email.raw | gorgeous -F email -T txt -q /subject\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmislav%2Fgorgeous","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmislav%2Fgorgeous","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmislav%2Fgorgeous/lists"}