{"id":13635081,"url":"https://github.com/endocrimes/Jay","last_synced_at":"2025-04-19T03:34:20.725Z","repository":{"id":56916884,"uuid":"51947082","full_name":"endocrimes/Jay","owner":"endocrimes","description":"Pure-Swift JSON parser \u0026 formatter. Fully streamable input and output. Linux \u0026 OS X ready. Replacement for NSJSONSerialization.","archived":true,"fork":false,"pushed_at":"2017-03-20T11:12:56.000Z","size":407,"stargazers_count":132,"open_issues_count":8,"forks_count":19,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-01T22:17:33.693Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Swift","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/endocrimes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-17T18:57:35.000Z","updated_at":"2023-01-28T09:58:34.000Z","dependencies_parsed_at":"2022-08-21T03:50:46.404Z","dependency_job_id":null,"html_url":"https://github.com/endocrimes/Jay","commit_stats":null,"previous_names":["czechboy0/jay","dantoml/jay"],"tags_count":39,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/endocrimes%2FJay","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/endocrimes%2FJay/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/endocrimes%2FJay/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/endocrimes%2FJay/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/endocrimes","download_url":"https://codeload.github.com/endocrimes/Jay/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249600504,"owners_count":21297707,"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-08-02T00:00:40.451Z","updated_at":"2025-04-19T03:34:20.440Z","avatar_url":"https://github.com/endocrimes.png","language":"Swift","funding_links":[],"categories":["JSON Parse"],"sub_categories":[],"readme":"# Jay\n\n[![Build Status](https://travis-ci.org/DanToml/Jay.svg?branch=master)](https://travis-ci.org/DanToml/Jay)\n[![Latest Release](https://img.shields.io/github/release/DanToml/jay.svg)](https://github.com/DanToml/jay/releases/latest)\n![Platforms](https://img.shields.io/badge/platforms-Linux%20%7C%20OS%20X-blue.svg)\n![Package Managers](https://img.shields.io/badge/package%20managers-SwiftPM-yellow.svg)\n\n\u003e Pure-Swift JSON parser \u0026 formatter. Fully streamable input and output. Linux \u0026amp; OS X ready. Replacement for NSJSONSerialization.\n\nJay conforms to the following specifications:\n- JSON [RFC4627](http://www.ietf.org/rfc/rfc4627.txt)\n- [Open Swift C7 JSON](https://github.com/open-swift/C7/blob/master/Sources/JSON.swift) with the use of [Jay-C7](https://github.com/czechboy0/Jay-C7)\n\nFor extra convenience functions when working with the JSON enum, check out [Jay-Extras](https://github.com/czechboy0/Jay-Extras).\n\n# :question: Why?\nWe all use JSON. Especially when writing server-side Swift that needs to run on Linux. `#0dependencies`\n\nThis is my take on how a JSON parser should work. *This is not another JSON mapping utility library.* This is an actual **JSON parser** and **formatter**. Check out the code, it was fun to write 😇\n\n# Features\n- [x] Parsing: data -\u003e JSON object\n- [x] Formatting: JSON object -\u003e data\n- [x] Pretty printing\n- [x] Streaming input and output, low memory footprint\n\n# Usage\n\n## Parsing from data (deserialization)\n```swift\ndo {\n\t//get data from disk/network\n\tlet data: [UInt8] = ...\n\n\t//ask Jay to parse your data\n\tlet json = try Jay().jsonFromData(data) // JSON\n\t//or\n\tlet json = try Jay().anyJsonFromData(data) // [String: Any] or [Any]\n\n\t//if it doesn't throw an error, all went well\n\tif let tasks = json.dictionary?[\"today\"]?.array {\n\t    //you have a dictionary root object, with an array under the key \"today\"\n\t    print(tasks) //[\"laundry\", \"cook dinner for gf\"]\n\t} \n} catch {\n\tprint(\"Parsing error: \\(error)\")\n}\n```\n\n## Formatting into data (serialization)\n```swift\ndo {\n\t//get a json object (works for both [String: Any] and typesafe versions - JSON)\n\n\t//ask Jay to generate data\n\tlet anyContainer = ... // [String: Any] or [Any]\n\tlet data = try Jay(formatting: .prettified).dataFromJson(any: json) // [UInt8]\n\t//or\n\tlet json: JSON = ... // JSON\n\tlet data = try Jay(formatting: .prettified).dataFromJson(json: json) // [UInt8]\n\n\t//send data over network, save to disk\n} catch {\n\tprint(\"Formatting error: \\(error)\")\n}\n```\n\n# Installation\n\n## Swift Package Manager\n\n```swift\n.Package(url: \"https://github.com/czechboy0/Jay.git\", majorVersion: 1)\n```\n\n:blue_heart: Code of Conduct\n------------\nPlease note that this project is released with a [Contributor Code of Conduct](./CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.\n\n:gift_heart: Contributing\n------------\nPlease create an issue with a description of your problem or open a pull request with a fix.\n\n:v: License\n-------\nMIT\n\n:alien: Author\n------\nHonza Dvorsky - http://honzadvorsky.com, [@czechboy0](http://twitter.com/czechboy0)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fendocrimes%2FJay","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fendocrimes%2FJay","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fendocrimes%2FJay/lists"}