[feature/api] Corrected datatypes when serializing JSON

Previously the Symfony Serializer would serialize numbers as strings.
This could lead to various issues when using the API in languages that
enforces data types, where you would get a string where you expected
an int. Now numbers are correctly threated as integers when serializing.

PHPBB3-11595