AlamofireJsonToObjects alternatives and similar libraries
Based on the "JSON" category.
Alternatively, view AlamofireJsonToObjects alternatives based on common mentions on social networks and blogs.
-
JSONModel
Magical Data Modeling Framework for JSON - allows rapid creation of smart data models. You can use it in your iOS, macOS, watchOS and tvOS apps. -
JSONExport
JSONExport is a desktop application for Mac OS X which enables you to export JSON objects as model classes with their associated constructors, utility methods, setters and getters in your favorite language. -
Gloss
DISCONTINUED. [Deprecated] A shiny JSON parsing library in Swift :sparkles: Loved by many from 2015-2021 -
Genome
A simple, type safe, failure driven mapping library for serializing JSON to models in Swift 3.0 (Supports Linux) -
CodableAlamofire
DISCONTINUED. An extension for Alamofire that converts JSON data into Decodable objects. -
Elevate
Elevate is a JSON parsing framework that leverages Swift to make parsing simple, reliable and composable. -
OCMapper
Objective-C library to easily map NSDictionary to model objects, works perfectly with Alamofire. ObjectMapper works similar to GSON -
Jay
DISCONTINUED. Pure-Swift JSON parser & formatter. Fully streamable input and output. Linux & OS X ready. Replacement for NSJSONSerialization.
CodeRabbit: AI Code Reviews for Developers
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of AlamofireJsonToObjects or a related project?
README
AlamofireJsonToObjects
๐จ This is now a subspec of EVReflection and the code is maintained there. ๐จ
You can install it as a subspec like this:
use_frameworks!
pod "EVReflection/Alamofire"
Besideds this subspec there are also subspecs for: XML, AlamofireXML, Moya, MoyaRxSwift and MoyaReflectiveSwift
If you have a question and don't want to create an issue, then we can (EVReflection is the base of AlamofireJsonToObjects)
With AlamofireJsonToObjects it's extremely easy to fetch a json feed and parse it into objects. No property mapping is required. Reflection is used to put the values in the corresponding properties.
AlamofireJsonToObjects is based on the folowing libraries:
- Alamofire is an elegant HTTP Networking library in Swift
- EVReflection is used to parse the JSON result to your objects
This library was greatly inspired by AlamofireObjectMapper
At this moment the master branch is for Swift3. If you want to continue using Swift 2.2 (or 2.3) then switch to the Swift2.2 branch. Run the tests to see AlamofireJsonToObjects in action.
Using AlamofireJsonToObjects in your own App
'AlamofireJsonToObjects' is available through the dependency manager CocoaPods.
You can just add AlamofireJsonToObjects to your workspace by adding the folowing 2 lines to your Podfile:
use_frameworks!
pod "AlamofireJsonToObjects"
you also have to add an import at the top of your swift file like this:
import AlamofireJsonToObjects
Sample code
class WeatherResponse: EVNetworkingObject {
var location: String?
var three_day_forecast: [Forecast] = [Forecast]()
}
class Forecast: EVNetworkingObject {
var day: String?
var temperature: NSNumber?
var conditions: String?
}
class AlamofireJsonToObjectsTests: XCTestCase {
func testResponseObject() {
let URL = "https://raw.githubusercontent.com/evermeer/AlamofireJsonToObjects/master/AlamofireJsonToObjectsTests/sample_json"
Alamofire.request(URL)
.responseObject { (response: DataResponse<WeatherResponse>) in
if let result = response.result.value {
// That was all... You now have a WeatherResponse object with data
}
}
waitForExpectationsWithTimeout(10, handler: { (error: NSError!) -> Void in
XCTAssertNil(error, "\(error)")
})
}
}
The code above will pass the folowing json to the objects:
{ "location": "Toronto, Canada",
"three_day_forecast": [
{ "conditions": "Partly cloudy",
"day" : "Monday",
"temperature": 20
}, {
"conditions": "Showers",
"day" : "Tuesday",
"temperature": 22
}, {
"conditions": "Sunny",
"day" : "Wednesday",
"temperature": 28
}
]
}
Advanced object mapping
AlamofireJsonToObjects is based on EVReflection and you can use all EVReflection features like property mapping, converters, validators and key kleanup. See EVReflection for more information.
Handling HTTP status >= 300
When a network call returns a HTTP error status (300 or highter) then this will be added to the evReflectionStatuses as a custom error. see the unit test testErrorResponse as a sample. In order to make this work, you do have to set EVNetworkingObject as your bass class and not EVObject. You then also have to be aware that if you override the initValidation or the propertyMapping function, that you also have to call the super for that function.
License
AlamofireJsonToObjects is available under the MIT 3 license. See the LICENSE file for more info.
My other libraries:
Also see my other open source iOS libraries:
- EVReflection - Swift library with reflection functions with support for NSCoding, Printable, Hashable, Equatable and JSON
- EVCloudKitDao - Simplified access to Apple's CloudKit
- EVFaceTracker - Calculate the distance and angle of your device with regards to your face in order to simulate a 3D effect
- EVURLCache - a NSURLCache subclass for handling all web requests that use NSURLReques
- AlamofireJsonToObject - An Alamofire extension which converts JSON response data into swift objects using EVReflection
- AlamofireXmlToObject - An Alamofire extension which converts XML response data into swift objects using EVReflection and XMLDictionary
- AlamofireOauth2 - A swift implementation of OAuth2 using Alamofire
- EVWordPressAPI - Swift Implementation of the WordPress (Jetpack) API using AlamofireOauth2, AlomofireJsonToObjects and EVReflection (work in progress)
- PassportScanner - Scan the MRZ code of a passport and extract the firstname, lastname, passport number, nationality, date of birth, expiration date and personal numer.
*Note that all licence references and agreements mentioned in the AlamofireJsonToObjects README section above
are relevant to that project's source code only.