<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/parse-don-t-guess-cu2bmxcqr" -->

---
title: Parse, Don&#x27;t Guess | daily.dev
description: A developer shares how a sneaky Regex-based bigint auto-detection during JSON deserialization caused JavaScript event loop freezes in production. The fix...
canonical: https://daily.dev/posts/parse-don-t-guess-cu2bmxcqr
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Parse, Don&#x27;t Guess | daily.dev
og:description: A developer shares how a sneaky Regex-based bigint auto-detection during JSON deserialization caused JavaScript event loop freezes in production. The fix...
og:url: https://daily.dev/posts/parse-don-t-guess-cu2bmxcqr
og:image: https://api.daily.dev/og/posts/cU2BmxCQR.png
og:image:alt: Parse, Don&#x27;t Guess
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.

# Parse, Don't Guess

**[Architecture Weekly](https://daily.dev/sources/architectureweekly)** · 16 min read · 86 upvotes · 1 comments

## Summary

A developer shares how a sneaky Regex-based bigint auto-detection during JSON deserialization caused JavaScript event loop freezes in production. The fix involved dropping the global Regex reviver and replacing it with an explicit upcasting pattern — a function that converts stored types (strings) to application types (Date, bigint) only for declared fields. This same upcasting mechanism naturally extends to schema versioning: handling structural changes between document/event versions (V1 flat fields vs V2 nested objects) using upcast (read) and downcast (write) functions. The pattern is applied to both Pongo (document store) and Emmett (event store), enabling backward and forward compatibility without batch migrations.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.architecture-weekly.com/p/parse-dont-guess>

## Community discussion

Top comments from developers on daily.dev.

**@pboling** · 0 upvotes

> If you are interested in this sort of thing for Ruby (real AST/PEG parsing instead of Regex guessing): https://github.com/kettle-rb/tree_haver

---

Tags: [#architecture](https://daily.dev/tags/architecture), [#typescript](https://daily.dev/tags/typescript)

[View this post on daily.dev](https://daily.dev/posts/parse-don-t-guess-cu2bmxcqr)

```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":"Parse, Don't Guess","url":"https://daily.dev/posts/parse-don-t-guess-cu2bmxcqr","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/parse-don-t-guess-cu2bmxcqr"},"datePublished":"2026-03-02T17:24:04.172Z","dateModified":"2026-03-02T17:24:36.160Z","description":"A developer shares how a sneaky Regex-based bigint auto-detection during JSON deserialization caused JavaScript event loop freezes in production. The fix...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/c6351158b5822c8bf64e9ba8e27c1c74?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/c6351158b5822c8bf64e9ba8e27c1c74?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Architecture Weekly","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":"Architecture Weekly","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/de7f791943f4475191187c902742d2f7","url":"https://daily.dev/sources/architectureweekly"},"commentCount":1,"discussionUrl":"https://daily.dev/posts/parse-don-t-guess-cu2bmxcqr","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":86},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":1}],"keywords":"architecture,typescript","timeRequired":"PT16M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Architecture Weekly","item":"https://daily.dev/sources/architectureweekly"},{"@type":"ListItem","position":3,"name":"Parse, Don't Guess"}]}
{"@context":"https://schema.org","@type":"WebPage","@id":"https://daily.dev/posts/parse-don-t-guess-cu2bmxcqr","comment":[{"@type":"Comment","text":"If you are interested in this sort of thing for Ruby (real AST/PEG parsing instead of Regex guessing): https://github.com/kettle-rb/tree_haver","datePublished":"2026-03-10T03:44:11.358Z","url":"https://daily.dev/posts/cU2BmxCQR#c-Rf5BDTt7v","author":{"@type":"Person","name":"Peter Boling","url":"https://daily.dev/pboling","image":"https://avatars.githubusercontent.com/u/19505?v=4"}}]}
```

