haskell / haskell/aeson

Dealing with empty object from API service

Open
#642 2 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
Haskell
Stars
1.3k
Forks
336
Avg merge
3d 7h
Merged PRs (30d)
4

Description

Hi, what is the best to handle when we got `name: {}` (this is from nodejs backend) response from api service, meanwhile what i want is to assume it is 'name: {first: "", last: ""}` so I can parse it to
```Person {firstName :: Maybe Text, lastName :: Maybe Text}``` ?

supposed that I have the following types:
https://gist.github.com/Rizary/3b3865a145853cf04df7fad4e348a5c3

I finally use `optional` but actually that's not what I want, because I can't parsed the `name: {}` as `name: {first: "", last: ""}`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.