whatisgithub

What is jsen?

rogerluan/jsen — explained in plain English

Analysis updated 2026-07-17 · repo last pushed 2024-07-16

13SwiftAudience · developerComplexity · 2/5DormantSetup · easy

In one sentence

A lightweight Swift library that represents JSON as a type-safe enum, avoiding loose [String:Any] parsing and offering keypath access.

Mindmap

mindmap
  root((repo))
    What it does
      Type-safe JSON enum
      Literal syntax support
      Keypath subscript access
    Tech stack
      Swift
      Codable
    Use cases
      Parse API responses
      Avoid Any typing
      Navigate nested JSON
    Audience
      iOS developers
      Backend developers
    Platforms
      iOS macOS
      Linux

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 API JSON responses with compile-time type safety instead of Any.

USE CASE 2

Navigate deeply nested JSON with a single keypath subscript.

USE CASE 3

Convert between JSON and Swift types using Codable.

USE CASE 4

Replace loose [String:Any] dictionaries in an iOS or backend codebase.

What is it built with?

SwiftSwift Package Manager

How does it compare?

rogerluan/jsena9eelsh/heliocoreappdev/clipdock
Stars131313
LanguageSwiftSwiftSwift
Last pushed2024-07-16
MaintenanceDormant
Setup difficultyeasyhardmoderate
Complexity2/53/52/5
Audiencedeveloperdevelopergeneral

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

How do you get it running?

Difficulty · easy Time to first run · 5min

So what is it?

JSEN is a lightweight library that gives Swift developers a safer way to work with JSON data. Instead of using the common but loose [String:Any] pattern, where you lose track of what type each value actually is, JSEN wraps JSON into a Swift enum that knows exactly what kind of data it holds: numbers, strings, booleans, nulls, arrays, or nested dictionaries. The benefit is you get compile-time safety and clearer code, with fewer runtime surprises when dealing with API responses or data parsing. At its core, JSEN is simple. It's just one enum with seven cases, one for each JSON value type. The library then adds convenient shortcuts so you don't have to write verbose boilerplate. You can write JSON structures using familiar Swift literal syntax (like ["key": "value", "count": 42]), and the library automatically converts those into JSEN values. For variables that aren't literals, there's a % prefix operator that quickly wraps any value into its JSEN form. It also supports the standard Swift Codable protocol, so converting between JSON and JSEN works smoothly in both directions. This is most useful for iOS, macOS, or backend developers who regularly parse JSON from APIs and want type safety without boilerplate. If you're tired of seeing Any in your codebase or constantly unwrapping optionals to navigate nested JSON structures, JSEN helps. The library also includes a convenient keypath-based subscript, so instead of chaining optionals to dig into nested data like response["user"]?["profile"]?["name"], you can write response[keyPath: "user.profile.name"] and get the value in one line. The project is deliberately minimal by design. It does one thing well: represent JSON in a type-safe way without requiring heavyweight frameworks or code generation. It runs on all Apple platforms (iOS, macOS, watchOS, tvOS) and Linux, and is installable as a Swift Package.

Copy-paste prompts

Prompt 1
Show me how to parse a JSON API response into JSEN and read nested fields.
Prompt 2
Help me convert my existing [String:Any] JSON handling code to use JSEN.
Prompt 3
Explain how the keypath subscript works for digging into nested JSON in JSEN.
Prompt 4
Give me an example of using Codable with JSEN to decode a struct.

Frequently asked questions

What is jsen?

A lightweight Swift library that represents JSON as a type-safe enum, avoiding loose [String:Any] parsing and offering keypath access.

What language is jsen written in?

Mainly Swift. The stack also includes Swift, Swift Package Manager.

Is jsen actively maintained?

Dormant — no commits in 2+ years (last push 2024-07-16).

How hard is jsen to set up?

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

Who is jsen for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.