Sharing your experience with JSON:API


I’m curious whats your experience with Elm and JSON:API. I would be interested what works well, what is hard and if there are some things that are by Elm’s nature impossible to achieve.

Thank you

I’ve been using for this, which seems to work pretty well so far. My use-case is pretty simple, but I am using relationships and metadata, both of which are easy to setup with that library.

Here’s an example of how I decode relationships (aka. includes):

import Json.Decode as Decode exposing (..)
import Json.Decode.Pipeline exposing (custom)
import JsonApi.Decode as Decode
import JsonApi.Resource exposing (Resource)

decoder resource =
    (\... -> ...)
    |> custom (oneOf [ Decode.relationship "author" resource nameDecoder, succeed "Unknown" ])
    |> custom (maybe <| Decode.relationship "project" resource Projects.decoder)
    |> custom (oneOf [ Decode.relationships "tags" resource Categories.decoder, succeed [] ])

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.