whatisgithub

What is objectmapper?

tristanhimmelman/objectmapper — explained in plain English

Analysis updated 2026-06-24

9,151SwiftAudience · developerComplexity · 2/5Setup · easy

In one sentence

Swift library for iOS and macOS that converts JSON data from web APIs into Swift objects and back again in a single function call, handling nested objects, arrays, enums, and custom date transforms.

Mindmap

mindmap
  root((ObjectMapper))
    What it does
      JSON to Swift objects
      Swift objects to JSON
    Supported types
      Primitives and strings
      Arrays and dicts
      Nested objects
      Custom transforms
    Protocols
      Mappable
      StaticMappable
      ImmutableMappable
    Installation
      CocoaPods
      Carthage
      Swift Package Manager
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Parse a JSON API response into a typed Swift model object with one function call instead of writing repetitive decoding code.

USE CASE 2

Convert a nested Swift object tree, a User containing a list of Friend objects each with an Address, from a single JSON payload.

USE CASE 3

Transform raw JSON values like date strings into Swift Date objects using custom transformations before use.

USE CASE 4

Build Swift models with constant let properties from JSON using the ImmutableMappable protocol.

What is it built with?

SwiftiOSmacOSCocoaPodsCarthageSwift Package Manager

How does it compare?

tristanhimmelman/objectmapperdevtoys-app/devtoysmactheboredteam/boring.notch
Stars9,1519,2279,075
LanguageSwiftSwiftSwift
Setup difficultyeasyeasyeasy
Complexity2/51/51/5
Audiencedeveloperdevelopergeneral

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 30min

Add via CocoaPods, Carthage, or Swift Package Manager, works with any iOS or macOS Xcode project.

So what is it?

ObjectMapper is a Swift library for iOS and macOS development that handles the conversion between JSON data and Swift objects. JSON is the format most web APIs use to send data back and forth, and without a library like this, translating that raw data into usable Swift objects requires writing a lot of repetitive code by hand. ObjectMapper reduces that to a few lines. The core idea is that you define a model, which is just a description of what your data looks like, and then annotate it to tell ObjectMapper which JSON fields correspond to which properties. Once that mapping is defined, converting a JSON string to an object or converting an object back to JSON becomes a single function call. The library uses a custom operator to express these mappings in a compact, readable way. ObjectMapper handles a wide range of data types: numbers, strings, booleans, arrays, dictionaries, enums, and nested objects. If you have a User object that contains a list of Friend objects, and each Friend has an Address object, ObjectMapper can build that whole structure from a single JSON payload. It also supports custom transformations for cases where the raw JSON value needs to be converted before use, such as turning a date string into an actual Date object. The library offers several protocols to cover different coding styles. The standard Mappable protocol works for most cases. StaticMappable is available when you need to control how objects are created, for instance to pick a subclass based on what is in the JSON. ImmutableMappable is for situations where you want your model properties to be constants rather than variables, which is a common preference in Swift. Installation is handled through CocoaPods, Carthage, or Swift Package Manager, which are the standard dependency tools in the Apple ecosystem. The project also documents how to use ObjectMapper alongside Alamofire, a popular networking library, and Realm, a mobile database, making it easier to slot into a typical iOS app setup.

Copy-paste prompts

Prompt 1
Show me how to use ObjectMapper to parse a JSON string from an API into a Swift User model with name, email, and an array of tag strings.
Prompt 2
I have a nested JSON response, a User that contains a list of Address objects. Show me how to map this in Swift using ObjectMapper.
Prompt 3
How do I write a custom ObjectMapper transformation to convert an ISO 8601 date string from JSON into a Swift Date object?
Prompt 4
Show me how to use ObjectMapper with Alamofire to fetch JSON from an API and automatically decode it into a Swift model.

Frequently asked questions

What is objectmapper?

Swift library for iOS and macOS that converts JSON data from web APIs into Swift objects and back again in a single function call, handling nested objects, arrays, enums, and custom date transforms.

What language is objectmapper written in?

Mainly Swift. The stack also includes Swift, iOS, macOS.

How hard is objectmapper to set up?

Setup difficulty is rated easy, with roughly 30min to a first successful run.

Who is objectmapper for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.