haskell / haskell/aeson

Add some way (or document if it already exists) to extract data type name in 'defaultOptions'

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

Description

I want to add full data type name to every field of my data type. Like this:

```haskell
data ProjectManager = ProjectManager
{ projectManagerName :: Text
, projectManagerSalary :: Natural
}
```

And I want to have JSON encoding like this: `{ name: "Vasya Pupkin", salary: 42 }`. I don't see any way to implement general `Options` data type which can automatically work for any type with [`fieldLabelModifier`](https://hackage.haskell.org/package/aeson-1.2.4.0/docs/Data-Aeson.html#v:fieldLabelModifier) because I don't know type name from context.

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.