Handle non-scalars in json_array_get

This PR fixes #1901 by converting non-scalar array elements to string.