Bug 987383 - Make sure to deal with empty output so that JSON stay valid