Vanta Logo
SPONSOR
Automate SOC 2 & ISO 27001 compliance with Vanta. Get $1,000 off.
Up to date
Published
4 min read

Trevor I. Lasn

Staff Software Engineer, Engineering Manager

Pkl: Apple's New Configuration Language That Could Replace JSON and YAML

A deep dive into Pkl, Apple's configuration language that aims to replace JSON and YAML

Pkl (pronounced “Pickle”) is Apple’s take on configuration-as-code. It sits between traditional formats like JSON and full programming languages like Python, aiming to make configuration more reliable and maintainable.

Here’s what caught my attention about Pkl - it’s not trying to be another general-purpose programming language. Instead, it’s laser-focused on solving one specific problem: making configuration less painful.

As someone who’s wrestled with YAML indentation and JSON’s lack of comments more times than I care to count, I’m intrigued by what Apple is bringing to the table with Pkl.

What Makes Pkl Different?

Configuration files often start simple but grow complex over time. Think about a typical deployment config - it might begin with a few environment variables but evolve into hundreds of lines spanning multiple services. YAML and JSON struggle with this complexity, while general programming languages can be overkill.

Pkl isn’t just another configuration format. It’s a blend between a static config format (like JSON/YAML) and a programming language. Think of it as having the simplicity of YAML but with the power to actually do stuff when you need it.

Pkl
// Basic config
name = "My Service"
port = 8080
// Template for shared settings
baseService {
image = "nginx:1.19"
healthCheck = true
}
// Reuse template for specific services
webService = new baseService {
port = 80
}
apiService = new baseService {
port = 3000
}

The code above shows Pkl’s hybrid nature. It’s as readable as YAML but supports abstraction and reuse like a programming language.

Pkl enforces immutability - once you define a value, it can’t be changed. This prevents a whole class of configuration errors where values get accidentally modified. The language also includes built-in validation through schemas:

Pkl
class DatabaseConfig {
host: String
port: Int
function validate() {
port > 0 && port < 65536
}
}

The schema validates your configuration at evaluation time, catching errors before they reach production.

Pkl is designed to fit into existing workflows. It can output to JSON, YAML, XML, and Java Properties files. This means you can use Pkl to generate configuration for tools that expect these formats. It also offers integration libraries for multiple languages:

  1. JVM (Java and Kotlin)
  2. Swift
  3. Go

These libraries let applications directly read and parse Pkl configurations, eliminating the need for intermediate JSON or YAML files.

Consider a common microservices setup. Each service might need similar but slightly different configuration. In YAML, this often leads to copy-pasted blocks with minor changes. Pkl handles this more elegantly through inheritance and composition.

Pkl
// Base application config with shared defaults
class AppConfig {
port: Int = 8080
logLevel: String = "INFO"
timeout: Duration = Duration.seconds(30)
}
// Specific service config
api = new AppConfig {
port = 3000
timeout = Duration.minutes(2)
}

Do We Really Need Another Language?

I have some reservations about Pkl that warrant discussion. First, introducing a new programming language, even a domain-specific one, brings significant overhead. Every new team member needs to learn it. Every toolchain needs to support it. Every CI/CD pipeline needs to handle it. That’s a lot of friction for something as fundamental as configuration.

The JVM integration also gives me pause. While Pkl claims to be lightweight, requiring a JVM runtime for configuration feels heavy-handed. For simple services or containerized environments where every megabyte counts, this could be a deal-breaker.

There’s also the question of Apple’s long-term commitment. Apple has a history of creating and then abandoning developer tools (remember WebObjects?)

While Pkl is open source, its development appears to be primarily driven by Apple. If they lose interest, the community might not be strong enough to maintain it.

The syntax, while clean, introduces yet another way to do things. We already have YAML, TOML, JSON5, and HCL. Each promised to solve configuration problems, yet here we are with another contender. This fragmentation in the configuration space might actually make things worse, not better.

The validation features, while impressive, could also be achieved with JSON Schema or OpenAPI specifications - tools that already have broad industry adoption and support. Is Pkl really solving problems we can’t solve with existing tools?

Looking at Apple’s own ecosystem, it’s interesting that they primarily use Information Property List and JSON for their platforms’ configuration. If Pkl is such a significant improvement, why isn’t it being used more extensively in Apple’s own products?

These concerns don’t invalidate Pkl’s innovations, but they do suggest we should be cautious about adopting it, especially for projects that don’t have Apple’s scale of configuration complexity.

I’m also skeptical about enterprise adoption. Large organizations often have strict requirements about introducing new languages and tools. Convincing security teams to approve a new configuration language - even one from Apple - could be an uphill battle. The risk/reward ratio might not make sense for many businesses, especially when existing solutions, while imperfect, are well understood and have proven security track records.

These aren’t reasons to dismiss Pkl, but they are factors that deserve serious consideration before jumping on board.

The configuration landscape has been stagnant for years, dominated by formats designed decades ago. Pkl represents a fresh approach that acknowledges configuration’s evolution from simple key-value pairs to complex, mission-critical code.

Sources


Found this article helpful? You might enjoy my free newsletter. I share dev tips and insights to help you grow your coding skills and advance your tech career.

Interested in supporting this blog in exchange for a shoutout? Get in touch.


Liked this post?

Check out these related articles that might be useful for you. They cover similar topics and provide additional insights.

Tech
5 min read

Understanding Agent2Agent (A2A): A Protocol for LLM Communication

An exploration of Google's new open protocol that enables different AI systems to exchange information and collaborate

Apr 13, 2025
Read article
Tech
3 min read

When Will We Have Our First AI CEO?

Welcome to the future of corporate leadership. It's efficient, profitable, and utterly inhuman

Nov 4, 2024
Read article
Tech
4 min read

Why I moved from Google Analytics to Simple Analytics

I ditched Google Analytics for a privacy-focused analytics tool that bypasses ad blockers

Nov 9, 2024
Read article
Tech
5 min read

VoidZero: Threat or Catalyst for Open Source JavaScript Tooling?

When Evan You announced VoidZero, I'll admit - I got excited. And a little nervous.

Oct 15, 2024
Read article
Tech
3 min read

The Crutch Effect: How AI Tools Became A Crutch

Introducing The Crutch Effect

Sep 13, 2024
Read article
Tech
5 min read

Cloudflare's AI Content Control: Savior or Threat to the Open Web?

How Cloudflare's new AI management tools could revolutionize content creation, potentially reshaping the internet landscape for both website owners and AI companies.

Sep 24, 2024
Read article
Tech
11 min read

Google's Journey: From Search Engine to Tech Giant

Exploring the key innovations and strategies that transformed Google into a global technology leader

Oct 1, 2024
Read article
Tech
5 min read

Can OSSPledge Fix Open Source Sustainability?

The Open Source Pledge aims to address open source sustainability challenges by encouraging companies to pay $2,000 per developer per year

Nov 17, 2024
Read article
Tech
3 min read

Why Anthropic (Claude AI) Uses 'Member of Technical Staff' for All Engineers (Including Co-founders)

Inside Anthropic's unique approach to preventing talent poaching and maintaining organizational equality

Oct 23, 2024
Read article

This article was originally published on https://www.trevorlasn.com/blog/pkl-apple-new-configuration-language. It was written by a human and polished using grammar tools for clarity.