{"id":15467141,"url":"https://github.com/jonahwilliams/typewriter","last_synced_at":"2025-04-22T11:25:43.412Z","repository":{"id":87993136,"uuid":"82020221","full_name":"jonahwilliams/typewriter","owner":"jonahwilliams","description":null,"archived":false,"fork":false,"pushed_at":"2017-05-14T08:10:59.000Z","size":61,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-18T23:32:00.131Z","etag":null,"topics":["dart","deserialization","json","serialization","xml"],"latest_commit_sha":null,"homepage":null,"language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonahwilliams.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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":"2017-02-15T04:28:33.000Z","updated_at":"2022-11-13T16:56:21.000Z","dependencies_parsed_at":"2023-05-22T07:00:22.844Z","dependency_job_id":null,"html_url":"https://github.com/jonahwilliams/typewriter","commit_stats":{"total_commits":12,"total_committers":1,"mean_commits":12.0,"dds":0.0,"last_synced_commit":"47c661903d822190eee9d418d7bde7b4e6d28b9a"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonahwilliams%2Ftypewriter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonahwilliams%2Ftypewriter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonahwilliams%2Ftypewriter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonahwilliams%2Ftypewriter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonahwilliams","download_url":"https://codeload.github.com/jonahwilliams/typewriter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250230016,"owners_count":21396222,"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":["dart","deserialization","json","serialization","xml"],"created_at":"2024-10-02T01:20:19.675Z","updated_at":"2025-04-22T11:25:43.388Z","avatar_url":"https://github.com/jonahwilliams.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Typewriter [![Build Status](https://travis-ci.org/jonahwilliams/typewriter.svg?branch=master)](https://travis-ci.org/jonahwilliams/typewriter)\n\n\u003cb\u003eTypewritter\u003c/b\u003e is a Dart library for generating [codecs](https://www.dartlang.org/articles/libraries/converters-and-codecs), encoder/decoder pairs for serialization.  Serialization code is repetitive and time consuming to write.  Instead of using reflection/mirrors, Typewriter enables developers to generate configurable codecs automatically from Dart source code.\n\nThe supported target languages are\n* JSON\n* XML (partial)\n* Yaml (planned) \n\nThis library is currently under active development and is not stable enough for non-experimental use.\n\n## Example Usage\nTypewriter annotations configure the behavior of the generated codecs.  For example, the following Class uses a `JsonKey` annotation, which changes the name of the field on the resulting JSON.\n\n```dart\n@deriveJson()\nclass Person {\n  int age;\n  @jsonProperty('birth_day')\n  DateTime birthDay;\n  String name;\n  Cat myCat;\n}\n\n@deriveJson()\nclass Cat {\n  String name;\n}\n```\nAn instance of this class serialized to JSON would look something like the following.\n\n```json\n{ \"age\": 25, \"birth_day\": \"some-long-iso-string\", \"name\": \"Jonah\", \"myCat\": {\"name\": \"Mike Hat\"}}\n```\n\nXml annotations support configuring the names of elements and child elements with `XmlElement`.  The annotation `XmlAttribute` allows developers to place annotations on any of the elements in the class.\n\n```dart\n@deriveXml()\nclass ApiResponse {\n  @xmlElement('name-list', 'name')\n  List\u003cString\u003e names;\n  \n  @xmlAttribute('name-length', element: 'name-list')\n  int length;\n}\n```\nThe following is an instance of `ApiResponse` serialized to XML.  Typewriter also handles the xml header.\n```xml\n\u003c?xml version=\"1.0\"?\u003e\n\u003cApiResponse\u003e\n  \u003cname-list length=\"3\"\u003e\n    \u003cname\u003ePeter Parker\u003c/name\u003e\n    \u003cname\u003eBruce Wayne\u003c/name\u003e\n    \u003cname\u003eSnoop Dogg\u003c/name\u003e\n  \u003c/name-list\u003e\n\u003c/ApiResponse\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonahwilliams%2Ftypewriter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonahwilliams%2Ftypewriter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonahwilliams%2Ftypewriter/lists"}