Skip to content

Add function to decode the contetns of a JSON string with another decoder#35

Open
kintrix007 wants to merge 1 commit intoelm:masterfrom
kintrix007:decode-string-as
Open

Add function to decode the contetns of a JSON string with another decoder#35
kintrix007 wants to merge 1 commit intoelm:masterfrom
kintrix007:decode-string-as

Conversation

@kintrix007
Copy link

Closes #33

Maybe it would be worth discussing the exact API to publish.

I personally think it is fine to add a function like stringAs : Decoder a -> Decoder a to the public API, I can see how it is rare to want to decode the string as anything but an integer or a float.

Because of that it might be a better idea to expose functions stringAsInt : Decoder Int and stringAsFloat : Decoder Float instead. Maybe alongside a generic stringAs, to support weird use-cases?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add function to parse JSON string as a number instead. ("42" -> 42)

1 participant