**How to reproduce**

```
:) CREATE TABLE `test` (`data` Int64) ENGINE=MergeTree() ORDER BY(`data`);

CREATE TABLE test
(
    `data` Int64
)
ENGINE = MergeTree()
ORDER BY data

Ok.

0 rows in set. Elapsed: 0.007 sec. 
```

```
:) INSERT INTO `test` VALUES(100);

INSERT INTO test VALUES

Ok.

1 rows in set. Elapsed: 0.002 sec. 
```

```
:) SELECT * FROM `test`;

SELECT *
FROM test

┌─data─┐
│  100 │
└──────┘

1 rows in set. Elapsed: 0.002 sec. 
```

```
:) SELECT * FROM `test` FORMAT JSON;

SELECT *
FROM test
FORMAT JSON

{
	"meta":
	[
		{
			"name": "data",
			"type": "Int64"
		}
	],

	"data":
	[
		{
			"data": "100"

	],

	"rows": 1,

	"statistics":
	{
		"elapsed": 0.001765624,
		"rows_read": 1,
		"bytes_read": 8
	}
}

1 rows in set. Elapsed: 0.005 sec. 
```

---

**Which ClickHouse server version to use**

I am using the clickhouse-server docker image. Image ID: `3aa412f816ec`

```
# clickhouse-client
ClickHouse client version 20.6.3.28 (official build).
Connecting to localhost:9000 as user default.
Connected to ClickHouse server version 20.6.3 revision 54436.
```

---

**Expected behavior**

In the `FORMAT JSON` output, I expected the `data` field to be a valid JSON. But it is not. The closing curly bracket for the object is missing.

**Error message and/or stacktrace**

![Screenshot from 2020-08-10 20-18-21](https://user-images.githubusercontent.com/12874561/89796005-b8a16500-db46-11ea-840f-b98b4210d76b.png)

std::optional<Settings> old_settings
            SCOPE_EXIT({ if (old_settings) context.setSettings(*old_settings) )
            auto apply_query_settings = [&](const IAST & settings_ast)
            {
                if (!old_settings)
                    old_settings.emplace(context.getSettingsRef())
                context.applySettingsChanges(settings_ast.as<ASTSetQuery>()->changes)
            
            const auto * insert = parsed_query->as<ASTInsertQuery>()
            if (insert && insert->settings_ast)
                apply_query_settings(*insert->settings_ast)
            /// FIXME: try to prettify this st using `as<>()`
            const auto * ith_output = dynamic_st<const ASTQueryWithOutput *>(parsed_query.get())
            if (ith_output && ith_output->settings_ast)
                apply_query_settings(*ith_output->settings_ast)
            connection->forceConnected(connection_parameters.timeouts)
            ASTPtr input_function
            if (insert && insert->select)
                insert->tryFindInputFunction(input_function)
            /// INSERT query for hich da transfer is needed (not an INSERT SELECT or input()) is processed separately.
            if (insert && (!insert->select || input_function) && !insert->atch)
            {
                if (input_function && insert->format.empty())
                    thro Exception("FORMAT must be specified for function input()", ErrorCodes::INVALID_USAGE_OF_INPUT)
                processInsertQuery()
            
            else
                processOrdinaryQuery()
        
        /// Do not change context (current DB, settings) in se of an exception.