diff --git a/modules/openapi-generator/src/main/resources/cpp-pistache-server/api-source.mustache b/modules/openapi-generator/src/main/resources/cpp-pistache-server/api-source.mustache
index 4e35d5f863e8ad09afa68a5607eb73a27298b863..31afee650ffa173096e64bfced0686eb5a55c903 100644
--- a/modules/openapi-generator/src/main/resources/cpp-pistache-server/api-source.mustache
+++ b/modules/openapi-generator/src/main/resources/cpp-pistache-server/api-source.mustache
@@ -70,7 +70,12 @@ void {{classname}}::{{operationIdSnakeCase}}_handler(const Pistache::Rest::Reque
     try {
     {{#hasBodyParam}}
     {{#bodyParam}}
+    {{^isPrimitiveType}}
       nlohmann::json::parse(request.body()).get_to({{paramName}});
+    {{/isPrimitiveType}}
+    {{#isPrimitiveType}}
+      {{paramName}} = request.body();
+    {{/isPrimitiveType}}
     {{/bodyParam}}
     {{/hasBodyParam}}
       this->{{operationIdSnakeCase}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{#hasParams}}, {{/hasParams}}response);
diff --git a/samples/server/petstore/cpp-pistache/.openapi-generator/VERSION b/samples/server/petstore/cpp-pistache/.openapi-generator/VERSION
index 479c313e87b9d6831eb89b5786aff0d08d26daf6..83a328a9227eeb701e955686cfc946eff558dc31 100644
--- a/samples/server/petstore/cpp-pistache/.openapi-generator/VERSION
+++ b/samples/server/petstore/cpp-pistache/.openapi-generator/VERSION
@@ -1 +1 @@
-4.0.3-SNAPSHOT
\ No newline at end of file
+4.1.0-SNAPSHOT
\ No newline at end of file