<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/parsing-json-objects-without-intermediate-asts-nvz6eekzp" -->

---
title: Parsing JSON Objects without intermediate ASTs | daily.dev
description: An experiment demonstrates parsing JSON directly into a domain data type without building an intermediate AST representation, using partially-initialised...
canonical: https://daily.dev/posts/parsing-json-objects-without-intermediate-asts-nvz6eekzp
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Parsing JSON Objects without intermediate ASTs | daily.dev
og:description: An experiment demonstrates parsing JSON directly into a domain data type without building an intermediate AST representation, using partially-initialised...
og:url: https://daily.dev/posts/parsing-json-objects-without-intermediate-asts-nvz6eekzp
og:image: https://api.daily.dev/og/posts/nvZ6EEkzP.png
og:image:alt: Parsing JSON Objects without intermediate ASTs
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Parsing JSON Objects without intermediate ASTs

**[Lobsters](https://daily.dev/sources/lobsters)** · 9 min read · 0 upvotes · 0 comments

## Summary

An experiment demonstrates parsing JSON directly into a domain data type without building an intermediate AST representation, using partially-initialised objects with lazy `undefined` fields tracked by a bitset to ensure all required fields are set. Implemented in Haskell with the flatparse library and Template Haskell for code generation, benchmarks show the no-IR approach is roughly three times faster than the equivalent using an AST-based intermediate representation, comparable to results from libraries like aeson. The author notes the approach trades maintainability and safety for speed and mentions Rust's serde achieves similar IR elimination via compile-time staged programming.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://arthi-chaud.github.io/posts/json-ir>

## Questions this post answers

### How much faster is parsing JSON directly into a struct compared to using an intermediate AST representation?

Parsing without an intermediate representation is roughly three times faster in Haskell benchmarks. For an object similar in size to a book record, the no-IR approach took 314.2 ns versus 922.7 ns with an IR using the same library, and versus 1.051 μs using aeson, which also relies on an IR-based AST for JSON.

_Developers chasing parser performance gains can track benchmarking approaches like this one on daily.dev._

### How do you track which fields have been set when parsing into a partially-initialized Haskell record with undefined placeholders?

A bit set, such as a Word64 initialized to maxBound, tracks field completion by clearing the bit at the position corresponding to each field once it is parsed and assigned. After parsing finishes, checking whether the bit set equals zero confirms every required field was set, since evaluating an unset undefined field would otherwise crash the program.

_Engineers exploring unconventional Haskell parsing techniques can follow deep dives like this on daily.dev._

## Similar posts on daily.dev

- [Rewriting our Rust WASM Parser in TypeScript](https://daily.dev/posts/rewriting-our-rust-wasm-parser-in-typescript-l5hpi7vvy) · Hacker News · 19 upvotes · 1 comments
- [Rusty thoughts on "Parse, don't validate"](https://daily.dev/posts/rusty-thoughts-on-parse-don-t-validate--pcdgqdpoi) · Eli Bendersky · 7 upvotes · 1 comments
- [Super-flat ASTs](https://daily.dev/posts/super-flat-asts-noiwfdhlo) · Lobsters · 0 upvotes · 0 comments
- [Parse, don't Validate and Type-Driven Design in Rust — ramblings of @harudagondi](https://daily.dev/posts/parse-don-t-validate-and-type-driven-design-in-rust-ramblings-of-harudagondi-je8owvusb) · Hacker News · 0 upvotes · 0 comments

---

Tags: [#performance](https://daily.dev/tags/performance), [#rust](https://daily.dev/tags/rust), [#haskell](https://daily.dev/tags/haskell)

[View this post on daily.dev](https://daily.dev/posts/parsing-json-objects-without-intermediate-asts-nvz6eekzp)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Parsing JSON Objects without intermediate ASTs","url":"https://daily.dev/posts/parsing-json-objects-without-intermediate-asts-nvz6eekzp","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/parsing-json-objects-without-intermediate-asts-nvz6eekzp"},"datePublished":"2026-09-24T04:03:41.528Z","dateModified":"2026-09-24T04:04:02.499Z","description":"An experiment demonstrates parsing JSON directly into a domain data type without building an intermediate AST representation, using partially-initialised...","image":"https://media.daily.dev/image/upload/s--ZrL_HSsR--/f_auto/v1722860399/public/Placeholder%2006","thumbnailUrl":"https://media.daily.dev/image/upload/s--ZrL_HSsR--/f_auto/v1722860399/public/Placeholder%2006","isAccessibleForFree":true,"articleSection":"Lobsters","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Lobsters","logo":"https://media.daily.dev/image/upload/s--tl8v_Fku--/f_auto,t_logo/v1698841318/logos/lobste.jpg","url":"https://daily.dev/sources/lobsters"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/parsing-json-objects-without-intermediate-asts-nvz6eekzp","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"performance,rust,haskell","timeRequired":"PT9M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Lobsters","item":"https://daily.dev/sources/lobsters"},{"@type":"ListItem","position":3,"name":"Parsing JSON Objects without intermediate ASTs"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/parsing-json-objects-without-intermediate-asts-nvz6eekzp#faq","mainEntity":[{"@type":"Question","name":"How much faster is parsing JSON directly into a struct compared to using an intermediate AST representation?","acceptedAnswer":{"@type":"Answer","text":"Parsing without an intermediate representation is roughly three times faster in Haskell benchmarks. For an object similar in size to a book record, the no-IR approach took 314.2 ns versus 922.7 ns with an IR using the same library, and versus 1.051 μs using aeson, which also relies on an IR-based AST for JSON. Developers chasing parser performance gains can track benchmarking approaches like this one on daily.dev."}},{"@type":"Question","name":"How do you track which fields have been set when parsing into a partially-initialized Haskell record with undefined placeholders?","acceptedAnswer":{"@type":"Answer","text":"A bit set, such as a Word64 initialized to maxBound, tracks field completion by clearing the bit at the position corresponding to each field once it is parsed and assigned. After parsing finishes, checking whether the bit set equals zero confirms every required field was set, since evaluating an unset undefined field would otherwise crash the program. Engineers exploring unconventional Haskell parsing techniques can follow deep dives like this on daily.dev."}}]}
```

