Workout Builder JSON Variant

For people uploading sessions using some kind of scripting or even spreadsheets it would be nice if the builder recognized JSON in addition to the current human-oriented text format.

Obviously this is very niche, just putting it out there. Upvote if you like it.

Benefits:

  • Implicit syntax check - if it is not parseable JSON the API call should error out with some HTTP 4xx code.
  • Reasonably easy semantics check (correct key names and attribute types) eg. with a JSON Schema. Deny non conformance with a HTTP 4xx.
  • Easy to document (by just publishing the JSON Schema).

Some remarks:

  • Detection could be done heuristically, i.e. look for some JSON syntax elements that are required and then switch to either the existing or the JSON parser. Or just look for an opening brace in the first character for maximal simplicity.
  • … or, if this seems better or easier, by introducing a separate attribute; for the MVP without GUI at all.
  • The format should be as close to the internal representation of the data as possible to avoid effort and a further mapping step. Basically expose the internal data format as much as it makes sense (assuming that format is relatively sane :wink: ).
  • Strictly for automation… Fail fast, fail hard. Opposite of how error handling works in the human text format. Never guess anything, only take valid data.
  • For the MVP, keep it simple. I.e. no need for the GUI step dialog to emit JSON or anything like that.
  • Using JSON Schema would mean that even with minimal error reporting, user(-programmer)s can figure out what they did wrong much more easily.
  • For the MVP, no conversion from/to the human format.