Decoding JSON sum types in Go without panicking

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

InfluxDB high-performance time series database
Collect, organize, and act on massive volumes of high-resolution data to power real-time intelligent systems.
influxdata.com
featured
CodeRabbit: AI Code Reviews for Developers
Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.
coderabbit.ai
featured
  1. go

    The Go programming language

    [2]: https://github.com/golang/go/issues/71497

  2. InfluxDB

    InfluxDB high-performance time series database. Collect, organize, and act on massive volumes of high-resolution data to power real-time intelligent systems.

    InfluxDB logo
  3. pjson

    Helps to easily JSON marshal / unmarshal tagged unions in go

    Pulled my hair out about doing this all over the place when integrating with a node api, ended up writing https://github.com/byrnedo/pjson. Feels like this should be covered as a more first class thing in go.

  4. GJSON

    Get JSON values quickly - JSON parser for Go

    BTW double unmarshalling (and double marshalling) can be quite slow, so to speed up determining the object type you can extract the type field e.g. by using https://github.com/tidwall/gjson. It can be easily 10x faster for this kind of scenario

  5. jtug

    JTUG - JSON Tagged Union Go

  6. super

    An analytics database that puts JSON and relational tables on equal footing

    Nice article!

    Decoding sum types into Go interface values is obviously tricky stuff, but it gets even harder when you have recursive data structures as in an abstract syntax tree (AST). The article doesn't address this. Since there wasn't anything out there to do this, we built a little package called "unpack" as part of the SuperDB project.

    The package is here...

    https://github.com/brimdata/super/blob/main/pkg/unpack/refle...

    and an example use in SuperDB is here...

    https://github.com/brimdata/super/blob/main/compiler/ast/unp...

    Sorry it's not very well documented, but once we got it working, we found the approach quite powerful and easy.

  7. CodeRabbit

    CodeRabbit: AI Code Reviews for Developers. Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.

    CodeRabbit logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • Any way to convert unknown/dynamic json to generic object structure

    3 projects | /r/golang | 2 Mar 2023
  • Need help with getting the grandchild in nested JSON

    3 projects | /r/golang | 28 Feb 2023
  • Ad hoc JSON parsing

    4 projects | /r/golang | 16 Jan 2023
  • Is there a way to parse unstructured data?

    6 projects | /r/golang | 27 Nov 2022
  • I wrote a JSON parsing library that makes it easy to query and even do arithmetic operations on JSON.

    3 projects | /r/golang | 3 Jul 2022

Did you know that Go is
the 4th most popular programming language
based on number of references?