{"id":13563993,"url":"https://github.com/peheje/JsonSerializerSwift","last_synced_at":"2025-04-03T20:32:29.105Z","repository":{"id":88669702,"uuid":"44171227","full_name":"peheje/JsonSerializerSwift","owner":"peheje","description":"A simple Json Serializer for Swift","archived":false,"fork":false,"pushed_at":"2020-03-15T08:45:39.000Z","size":80,"stargazers_count":80,"open_issues_count":3,"forks_count":35,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-08-01T13:30:34.627Z","etag":null,"topics":["json-serialization","swift"],"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/peheje.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,"governance":null,"roadmap":null,"authors":null}},"created_at":"2015-10-13T11:19:59.000Z","updated_at":"2024-05-02T01:55:17.000Z","dependencies_parsed_at":"2024-01-14T03:47:58.695Z","dependency_job_id":"a89592f1-c363-409f-acb0-f6fbfbcbd476","html_url":"https://github.com/peheje/JsonSerializerSwift","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peheje%2FJsonSerializerSwift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peheje%2FJsonSerializerSwift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peheje%2FJsonSerializerSwift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peheje%2FJsonSerializerSwift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/peheje","download_url":"https://codeload.github.com/peheje/JsonSerializerSwift/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223030814,"owners_count":17076508,"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":["json-serialization","swift"],"created_at":"2024-08-01T13:01:25.349Z","updated_at":"2024-11-04T16:31:38.204Z","avatar_url":"https://github.com/peheje.png","language":"Swift","funding_links":[],"categories":["Swift"],"sub_categories":[],"readme":"# JsonSerializerSwift\nA simple Json Serializer for Swift\n\n**Update 14-06-2017:**\n\nMerged a pull request, now arrays of primitives are no longer enclosed in tuborg clamps {}. Updated tests to reflect this. Might be a breaking change, but it is fixing a bug.\n\n**Update 14-09-2016:**\n\nWorks with Swift 3.0. If you work with Swift 2.0 commit 921763ba36dbf1ce710f615d4c2ef838d2b4af3b will work. But I'm not planning on creating separate branches for Swift V2 and V3, so updates from now on will only be added to Swift 3.0 version.\n\n**About**\n\nParse your Swift object instances to a JSON string. This is a simple one-to-one conversion atm. Pretty print is supported. Properties will be named the same as in your classes as in the JSON string. \n\nUses reflection. On a MBP 15 Ultimo 2013 I'm getting about 1.5 sec for serializing a simple three-layer-inheritance object with 10000 array objects.\n\n**To use**\n\nHere a simple test case is shown. For more tests see the JsonSerializerSwiftTests file, git clone to run them yourself :)\n\n```swift\n//Arrange your model classes\nclass Object {\n  var id: Int = 182371823\n  }\nclass Animal: Object {\n  var weight: Double = 2.5\n  var age: Int = 2\n  var name: String? = \"An animal\"\n  }\nclass Cat: Animal {\n  var fur: Bool = true\n}\n\nlet m = Cat()\n\n//Act\nlet json = JSONSerializer.toJson(m)\n\n//Assert\nlet expected = \"{\\\"fur\\\": true, \\\"weight\\\": 2.5, \\\"age\\\": 2, \\\"name\\\": \\\"An animal\\\", \\\"id\\\": 182371823}\"\nstringCompareHelper(json, expected) //returns true\n\n```\nCurrently supports standard types, optional standard types, arrays, arrays of nullables standard types, array of custom classes, inheritance, composition of custom objects, structs.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeheje%2FJsonSerializerSwift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeheje%2FJsonSerializerSwift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeheje%2FJsonSerializerSwift/lists"}