akka / akka/akka-http

Review decision to require `RootJsonFormat` to marshal from/to Json

Open
#282 5 comments 0 reactions 0 assignees View on GitHub
1 - triaged
Dominant language
Scala
Stars
1.4k
Forks
584
Avg merge
14h 33m
Merged PRs (30d)
24

Description

**Issue by [jrudolph](https://github.com/jrudolph)**
_Thursday Jun 18, 2015 at 15:02 GMT_
_Originally opened as https://github.com/akka/akka/issues/17775_

---

The latest [JSON RFC 7159](https://tools.ietf.org/html/rfc7159) is less strict than other specifications before:

> A JSON text is a serialized value. Note that certain previous
> specifications of JSON constrained a JSON text to be an object or an
> array. Implementations that generate only objects or arrays where a
> JSON text is called for will be interoperable in the sense that all
> implementations will accept these as conforming JSON texts.

In spray-json the former restriction was modelled by `RootJsonFormat` which only consumes or produces json arrays or objects. Removing the restriction would make using spray-json with akka-http simpler with the potential disadvantage that we encourage a format that some peers possibly cannot understand.

On the other hand, changing to requiring `JsonFormat` would mean that suddenly Marshallers to/from most primitive types would be in scope that are likely to interfere with other ones.

/cc @sirthias

Contributor guide

Open the contributing guide

Research direction

No files, tests, or entry points are named. Start by reviewing the current akka-http JSON marshalling integration and the discussion around RootJsonFormat versus JsonFormat, then compare the options with RFC 7159. Done means reaching and documenting a decision about the required format and its compatibility trade-offs.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.