This is no good.
I always output details, also when empty.
This might give a parse error for JSON.
Must be fixed.