fixed JSON output, trimming empty elements (, [], {}, None)