add tests for missing/trailing brackets/braces

also fixed test for adding #to_json without loading json_compat
which is currently broken.