gleam-lang / json

🐑 Work with JSON in Gleam!

Home Page:https://hexdocs.pm/gleam_json/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JavaScript support

lpil opened this issue · comments

  • Use JS' built in JSON encoder/decoder.

@lpil I tried taking a crack at this (mostly just for fun as a way of learning more gleam) and have a draft PR here:
#5

Would love to know if this is on the right track or not! I'm running into failing tests which I think might be a bug with gleam/dynamic with javascript as the build target.

Wonderful. I couldn't see the failing test?

It might just be an environment issue on my end then. I was seeing these errors:

gleam_json_test.decode_bits_unexpected_format_test: Error:
        Error(UnexpectedFormat([DecodeError(expected: "Int", found: "Tuple of 0 elements", path: [])]))
        should equal
        Error(UnexpectedFormat([DecodeError(expected: "Int", found: "List", path: [])]))

gleam_json_test.decode_unexpected_format_test: Error:
        Error(UnexpectedFormat([DecodeError(expected: "Int", found: "Tuple of 0 elements", path: [])]))
        should equal
        Error(UnexpectedFormat([DecodeError(expected: "Int", found: "List", path: [])]))

When I went through those code paths, it seemed like something was going wrong in gleam/dynamic, but I am super new to gleam so I could be way off.

@lpil can this be closed? v0.5.0 suggests so :)

Oh yes! Thank you