Add the JSON_NUMERIC_CHECK flag in __toJson

This tells json_encode to convert all numeric strings to numbers.