As was previously mentioned, only bytes
cannot be cast
into json
. However, arrays and tuples can be cast into
json
just fine, even if they contain other nested
structures. Regular tuples and arrays both become JSON
arrays, but named tuples become JSON Objects. Try the
following cast of a complex nested structure: