anthonator

anthonator

Accent - Plug for converting JSON API keys to different cases

Hey everyone,

I published a new package yesterday that allows a client to request the case it prefers to see the keys of a JSON response in. For example, a JavaScript client may prefer a JSON response to be in pascalCase.

The main goal of the project was to provide the client the ability to make the choice of which case they prefer rather than hard coding a snake_case to pascalCase (or whatever) conversion.

By default, a client can send an Accent header to the server with the case they prefer. Out of the box, we support pascal, camel and snake as options. Both the header used and the supported cases can be customized.

Conversion works both ways. A client can request a response be formatted with a specific case and the server can convert an incoming request to a specific case as well.

Would love to hear your thoughts!

Hex: accent | Hex
Documentation: API Reference — accent v1.1.1

Most Liked

anthonator

anthonator

Thanks for the feedback!

I’m surprised you think that the use-case is very specific. We have a lot of clients for the web services we create that prefer either pascal or camel case. I think most companies use a RESTful API as opposed to GraphQL. Glad to hear your thoughts though!

I didn’t use Elixir’s implementation because they are not Unicode compliant. They only support ASCII. They say so as much in the Macro docs.

Thanks for the documentation suggestion! I’ll definitely do that.

Thanks again! I really appreciate the time you took take a look! :smile:

OvermindDL1

OvermindDL1

Nah I bet that was them, I’m surprised they are not unicode compliant, that sounds like a pending PR if they would take it, though considering its built for ‘elixir identifiers’, maybe not… ^.^

Where Next?

Popular in Announcing Top

msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 43622 214
New
deadtrickster
I’ve just released stable versions of my Prometheus Elixir libs: Elixir client [docs]; Ecto collector [docs]; Plugs instrumenter/Export...
New
brainlid
LangChain is short for Language Chain. An LLM, or Large Language Model, is the “Language” part. This library makes it easier for Elixir a...
New
oltarasenko
Dear Elixir community, After a year of development, bug fixes, and improvements, we are proudly ready to share the release of Crawly 0.1...
New
MRdotB
I needed to reuse React components from my Chrome extension in my Phoenix/LiveView backend. I noticed that for Svelte/Vue, there are live...
New
RobertDober
Earmark is a pure-Elixir Markdown converter. It is intended to be used as a library (just call Earmark.as_html), but can also be used as...
239 12560 134
New
sbs
Only 650 LOC, wrote for fun :slight_smile: https://github.com/sunboshan/qrcode
New
aditya7iyengar
Rummage.Ecto and Rummage.Phoenix provide ways to perform Searching, Sorting and Pagination over Ecto queries and Phoenix collections. Fo...
New
fuelen
Hey folks! Want to present a toolkit for writing command-line user interfaces. It provides a convenient interface for colorizing text...
New
benlime
LiveMotion enables high performance animations declared on the server and run on the client. As a follow up to my previous thread A libr...
New

Other popular topics Top

danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 29377 241
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
274 41539 114
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
chrismccord
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New

We're in Beta

About us Mission Statement