Hi,
documentation for functions `to_json` and `to_jsonb` states:
> Arrays and composites are converted (recursively) to arrays and
objects; otherwise, if there is a cast from the type to json, the cast
function will be used to perform the conversion; otherwise, a scalar
value is produced. For any scalar type other than a number, a Boolean,
or a null value, the text representation will be used, in such a fashion
that it is a valid json or jsonb value.
This might get interpreted in the sense that "if there is a cast from
the type to json, the cast function will be used to perform the
conversion" regardless of whether the value is an "array or composite".
https://stackoverflow.com/questions/35688503/
Would it be possible to adjust the wording in a way that makes this more
clear?
Or, alternatively, would it be possible to make use of implicit casts in
all cases so that the distinction needs not to be made?
Best regards
Jan Hamal Dvořák