{"id":1730,"url":"https://github.com/bernikovich/NSTEasyJSON","last_synced_at":"2025-08-02T04:32:24.565Z","repository":{"id":62448691,"uuid":"76636261","full_name":"bernikovich/NSTEasyJSON","owner":"bernikovich","description":"The better way to deal with JSON in Objective-C (inspired by SwiftyJSON)","archived":false,"fork":false,"pushed_at":"2018-06-18T13:14:21.000Z","size":25,"stargazers_count":12,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-01T10:23:37.586Z","etag":null,"topics":["cocoapods","ios","json","objective-c","swiftyjson"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","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/bernikovich.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":"2016-12-16T08:30:30.000Z","updated_at":"2023-11-29T08:35:58.000Z","dependencies_parsed_at":"2022-11-01T23:17:43.210Z","dependency_job_id":null,"html_url":"https://github.com/bernikovich/NSTEasyJSON","commit_stats":null,"previous_names":["bernikowich/nsteasyjson"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/bernikovich/NSTEasyJSON","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bernikovich%2FNSTEasyJSON","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bernikovich%2FNSTEasyJSON/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bernikovich%2FNSTEasyJSON/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bernikovich%2FNSTEasyJSON/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bernikovich","download_url":"https://codeload.github.com/bernikovich/NSTEasyJSON/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bernikovich%2FNSTEasyJSON/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268334617,"owners_count":24233793,"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","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["cocoapods","ios","json","objective-c","swiftyjson"],"created_at":"2024-01-05T20:15:54.438Z","updated_at":"2025-08-02T04:32:24.262Z","avatar_url":"https://github.com/bernikovich.png","language":"Objective-C","funding_links":[],"categories":["Parsing"],"sub_categories":["JSON"],"readme":"# NSTEasyJSON\n\nInpired by [SwiftyJSON](https://github.com/SwiftyJSON/SwiftyJSON). NSTEasyJSON makes it easy to deal with JSON data in Objective-C.\n\n1. [Why is the typical JSON handling in Objective-C NOT good](#why-is-the-typical-json-handling-in-objective-c-not-good)\n2. [Requirements](#requirements)\n3. [Integration](#integration)\n4. [Usage](#usage)\n   - [Initialization](#initialization)\n   - [Subscript](#subscript)\n   - [Optional getter](#optional-getter)\n   - [Non-optional getter](#non-optional-getter)\n\n## Why is the typical JSON handling in Objective-C NOT good?\n\nObjective-C is not very strict about types, but even without strictness we cannot save time because we have to check types ourselves for safety.\n\nTake the Twitter API for example. Say we want to retrieve a user's \"name\" value of some tweet in Objective-C (according to Twitter's API https://dev.twitter.com/docs/api/1.1/get/statuses/home_timeline).\n\nThe code would look like this:\n\n```objective-c\nNSDictionary *dictionary = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:\u0026error];\nNSString *user = dictionary[@\"user\"];\n// Now we got the username\n// But is it NSString for sure?\n```\n\nWe got the username in 2 lines, but will JSON always be NSDictionary? Can API send `null` as value for `user` key? To be safe we need to add some lines:\n\n```objective-c\nNSDictionary *dictionary = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:\u0026error];\nif (![dictionary isKindOfClass:[NSDictionary class]]) {\n\t// Print the error\n}\nNSString *user = dictionary[@\"user\"];\nif (![user isKindOfClass:[NSString class]]) {\n \t// Print the error\n}\n// There's our username\n```\n\nIt's simple, but it boilerplate for sure!\n\nWith NSTEasyJSON all you have to do is:\n\n```objective-c\nNSTEasyJSON *JSON = [NSTEasyJSON withData:dataFromNetworking];\nNSString *userName = JSON[0][\"user\"][\"name\"].string;\n// Now you got your value\n```\n\nAnd don't worry about the NSNull, out of bounds or other unexpected things. It's done for you automatically.\n\n## Requirements\n\n- iOS 7.0+ | macOS 10.10+ | tvOS 9.0+ | watchOS 2.0+\n- Xcode 7\n\n## Integration\n\n#### CocoaPods (iOS 7+, OS X 10.9+)\n\nYou can use [CocoaPods](http://cocoapods.org/) to install `NSTEasyJSON` by adding it to your `Podfile`:\n\n```ruby\nplatform :ios, '7.0'\n\ntarget 'MyApp' do\n\tpod 'NSTEasyJSON'\nend\n```\n\n#### Manually (iOS 7+, OS X 10.9+)\n\nTo use this library in your project manually you may:  \n\n1. for Projects, just drag NSTEasyJSON.{h,m} to the project tree\n2. for Workspaces, include the whole NSTEasyJSON.xcodeproj\n\n## Usage\n\n#### Initialization\n\n```objective-c\n#import \"NSTEasyJSON.h\"\n```\n\n```objective-c\nNSTEasyJSON *JSON = [NSTEasyJSON withData:dataFromNetworking];\n```\n\n```objective-c\nNSTEasyJSON *JSON = [NSTEasyJSON withObject:jsonObjectArrayOrMaybeDictionary];\n```\n\n#### Subscript\n\n```objective-c\n// Getting a double from a JSON Array\ndouble name = JSON[0].doubleValue;\n```\n\n```objective-c\n// Getting a string from a JSON Dictionary\nNSString *name = json[\"name\"].stringValue;\n```\n\n#### Optional getter\n\n```objective-c\n// NSNumber\nNSNumber *number = JSON[@\"user\"][@\"favourites_count\"].number;\n```\n\n```objective-c\n// NSString\nNSString *string = JSON[@\"user\"][@\"name\"].string;\n...\n```\n\n#### Non-optional getter\n\nNon-optional getters are named `xxxValue`\n\n```objective-c\n// If not a Number or nil, return 0\nNSNumber *number = JSON[@\"user\"][@\"favourites_count\"].numberValue;\n```\n\n```objective-c\n// If not a String or nil, return \"\"\nNSString *string = JSON[@\"user\"][@\"name\"].stringValue;\n```\n\n```objective-c\n// If not an Array or nil, return @[]\nNSArray *list = JSON[@\"list\"].arrayValue;\n```\n\n```objective-c\n// If not a Dictionary or nil, return @{}\nNSDictionary *dictionary = JSON[@\"user\"].dictionaryValue;\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbernikovich%2FNSTEasyJSON","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbernikovich%2FNSTEasyJSON","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbernikovich%2FNSTEasyJSON/lists"}