{"id":16371106,"url":"https://github.com/jodersky/yamlesque","last_synced_at":"2025-03-21T01:31:30.302Z","repository":{"id":57731647,"uuid":"128709925","full_name":"jodersky/yamlesque","owner":"jodersky","description":"Reads like yaml, writes like yaml; it must be yaml!","archived":false,"fork":false,"pushed_at":"2024-05-07T20:46:47.000Z","size":109,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-01T01:32:09.646Z","etag":null,"topics":["yaml"],"latest_commit_sha":null,"homepage":"","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jodersky.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-04-09T03:33:17.000Z","updated_at":"2024-05-07T20:46:51.000Z","dependencies_parsed_at":"2024-10-28T09:13:00.854Z","dependency_job_id":"8c28c74e-4eb9-4259-b652-91c06e1ce75b","html_url":"https://github.com/jodersky/yamlesque","commit_stats":{"total_commits":38,"total_committers":1,"mean_commits":38.0,"dds":0.0,"last_synced_commit":"cdbda6635d5d984a15b5ce50bc60bd51032e1207"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jodersky%2Fyamlesque","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jodersky%2Fyamlesque/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jodersky%2Fyamlesque/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jodersky%2Fyamlesque/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jodersky","download_url":"https://codeload.github.com/jodersky/yamlesque/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244097039,"owners_count":20397525,"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":["yaml"],"created_at":"2024-10-11T03:07:01.030Z","updated_at":"2025-03-21T01:31:30.004Z","avatar_url":"https://github.com/jodersky.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# yamlesque\n\n[![project chat](https://img.shields.io/badge/zulip-join_chat-brightgreen.svg)](https://crashbox.zulipchat.com/#narrow/stream/343723-yamlesque)\n[![yamlesque Scala version support](https://index.scala-lang.org/jodersky/yamlesque/yamlesque/latest.svg)](https://index.scala-lang.org/jodersky/yamlesque/yamlesque)\n[![stability: soft](https://img.shields.io/badge/stability-soft-white)](https://www.crashbox.io/stability.html)\n\nPure Scala YAML parsing.\n\nAs the name suggests, \"yaml-esque\" is a Scala implementation of the most\nfrequently used YAML features. It takes inspiration from [Li Haoyi's ujson](http://www.lihaoyi.com/post/uJsonfastflexibleandintuitiveJSONforScala.html)\nlibrary and aims to provide an idiomatic API that is cross-platform and has no\ndependencies.\n\n## Getting Started\n\nInclude yamlesque into a project.\n\n- mill:\n\n  ```scala\n  ivy\"io.crashbox::yamlesque::\u003clatest_tag\u003e\"\n  ```\n\n- sbt:\n\n  ```scala\n  \"io.crashbox\" %%% \"yamlesque\" % \"\u003clatest_tag\u003e\"\n  ```\n\n**Yamlesque is available for Scala 3 and 2.13, including ScalaJS and\nNative.**\n\nIt should also work with Scala 2.12, 2.11, 2.10 and 2.9, although no\npre-compiled libraries are published for these versions.\n\n### :point_right: [Online Converter](https://jodersky.github.io/yamlesque/) :point_left:\n\nBuilt with ScalaJS, this online converter allows you to transform\nYAML to JSON as you type.\n\n### Read Some YAML\n\n```scala\nval text = s\"\"\"|name: yamlesque\n               |description: a YAML library for scala\n               |authors:\n               |  - name: Jakob Odersky\n               |    id: jodersky\n               |\"\"\".stripMargin\n\nval yaml: yamlesque.Value = yamlesque.read(text)\n\nval id = yaml.obj(\"authors\").arr(0).obj(\"id\").str\n\nprintln(id) // == \"jodersky\"\n```\n\n### Write Some YAML\n\n```scala\nimport yamlesque as y\nval config = y.Obj(\n  \"auth\" -\u003e y.Obj(\n    \"username\" -\u003e y.Str(\"admin\"),\n    \"password\" -\u003e y.Str(\"guest\")\n  ),\n  \"interfaces\" -\u003e y.Arr(\n    y.Obj(\n      \"address\" -\u003e y.Str(\"0.0.0.0\"),\n      \"port\" -\u003e y.Str(\"80\")\n    ),\n    y.Obj(\n      \"address\" -\u003e y.Str(\"0.0.0.0\"),\n      \"port\" -\u003e y.Str(\"443\")\n    )\n  )\n)\n\nval stringly = config.render()\n\nprintln(stringly)\n```\n\nwill result in\n\n```yaml\nauth:\n  username: admin\n  password: guest\ninterfaces:\n  - address: 0.0.0.0\n    port: 80\n  - address: 0.0.0.0\n    port: 443\n```\n\n## Official YAML Conformance\n\n**Yamlesque does not strictly implement all features as defined in [YAML\n1.2](http://yaml.org/spec/1.2/spec.html), however support should be\nsufficient for most regular documents.**\n\nA major point of divergence between official YAML and this library is the way\nin which typing of strings is done. Whereas official YAML implicitly casts\nstrings to narrower types when possible (for example the string \"2\" is treated\nas the number 2), this library always treats strings as text. This approach\nleads to a more uniform parsing system which avoids many subtle bugs, including\nthe infamous [Norway\nProblem](https://hitchdev.com/strictyaml/why/implicit-typing-removed/). In your\napplication of course, you are still free to attempt to read strings as\ndiffferent types. Just the parser won't do this for you.\n\nAvailable features:\n\n- strings: plain (i.e. scalars) and double quoted\n- block-style strings (| and \u003e)\n- lists and maps\n- comments\n\nFeatures which are currently not supported but for which support is planned:\n\n- multiple documents (i.e. ---)\n- single quoted strings\n\nUnsupported features with no planned implementation:\n\n- anchors and references\n- flow-styles (aka inline JSON)\n- chomping modifiers (e.g. the '-' in '\u003e-')\n- tags\n\nPull requests with additional feature implementations are always welcome!\n\n## Geny-Compatible\n\nThe core type `yamlesque.Value` is a `geny.Writable`. This means that it will\nwork \"out-of-the-box\" with many other libraries from the [\"Singaporean\nStack\"](https://github.com/com-lihaoyi). Some examples:\n\nRead YAML from a file, using the os-lib library:\n\n```scala\nyamlesque.read(os.read.stream(os.pwd / \"config.yaml\"))\n```\n\nSend it as part of a HTTP request, using the scala-requests library:\n\n```scala\nval yaml: yamlesque.Value = ...\n\nrequests.post(\n  \"https://....\",\n  body = yaml\n)\n```\n\nSend it as part of a HTTP response, using the cask framework.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjodersky%2Fyamlesque","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjodersky%2Fyamlesque","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjodersky%2Fyamlesque/lists"}