On Wed, Apr 8, 2020 at 1:18 AM Wes Turner <wes.turner@gmail.com> wrote:

I don't see the value in using JSON to round-trip from Python to the same Python code.

There is a bit of a value: it's a human-readable format that matches the Python Data model pretty well. I've used it for that reason. Maybe I should be using yaml or something instead, but it's nice to use something common.

I have thought about using "PYSON" -- which would better match the Python data model, but never got around to formalizing that.

But yes, the real advantage to JSON is interaction with non-python systems.
 
External schema is far more useful than embedding part of an ad-hoc nested object schema in type annotations that can't also do or even specify data validations.

I suppose so -- I really need to see if I can make use of JSONSchema -- it would be nice to specify teh schema in one place, and be able to build Python objects, and Javascript objects, and theoretically all kinds of other implementations as well. Someone may have done that, I need to go look.

NOTE: JSON-LD keeps coming up in these thrteads, but that really seems like an orthogonal issue. Maybe there should be JSON-LD support for Python (is there already?) but that shouldn't impact the core json library, nor a __json__ magic method.

-CHB

--
Christopher Barker, PhD

Python Language Consulting
  - Teaching
  - Scientific Software Development
  - Desktop GUI and Web Development
  - wxPython, numpy, scipy, Cython