json functions: double quotes added when going through a variable
@Evan Carroll is certainly right about the general implementation of JSON in MariaDB.
But if you are still going with MariaDB this might help you:

The behavior you describe is a serious bug which is tracked here:
https://jira.mariadb.org/browse/MDEV-13701
As far as I understood its expected to be fixed with MariaDB-10.2.12.

For the time being I use the following hack:

set @jsonapiheader = json_object("jsonapi",json_object("version", CAST(1.0 AS DECIMAL(2,1))));
set @temp_json = concat('{"data":',@jsonapiheader,'}');
select @temp_json, json_valid(@temp_json);


Output:

{"data":{"jsonapi": {"version": 1.0}}}        |       1


Also look at the CAST within the first JSON_OBJECT. It also works with variables and functions and results in a more accurate JSON output.