software-challenge / software-challenge/backend

[Question/Wishlist] Using JSON for the protocol instead of XML

Open
#408 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
13
Forks
14
PR merge metrics
No merged PRs in 30d

Description

This is more of a general question rather than a specific issue. Has using JSON instead of XML for the protocol ever been considered, apart from legacy reasons?

While such a change would have quite a big impact on the way the different clients and the server handle communication, I think there are strong reasons for at least considering such a change e.g. for the next year:

  • JSON is ubiquitous, simple and easy to parse/serialize in almost every mainstream language (even hand-rolling a parser isn't too hard)
  • JSON maps very naturally to data structures in almost every mainstream language (in contrast to XML, where especially serialization can be very ambiguous, with regard to whether e.g. something should be serialized as text, an element, an attribute, etc.)
  • JSON is human-readable, debuggable and quite a bit less verbose than XML

A particular pain point with XML that I've encountered myself is e.g. the lack of good library support for Rust, leaving us essentially with either the option of hand-writing the XML mappings (which is tedious and error-prone) or using pretty limited tools for defining automatic mappings between structs and XML, which still require careful manual review of certain edge cases.

While these problems might not apply (as much) to other languages, JSON would solve pretty much all of these issues and at the same time simplify the protocol in general.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the server and client communication paths that implement the existing XML protocol. The issue points to Rust mapping examples in plugin-2021/src/game/game_state.rs and client-base/src/protocol/room.rs; determine the full migration scope and define acceptance criteria for equivalent JSON communication across clients and server.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.