oatpp / oatpp-mongo

Oat++ native BSON + MongoDB driver implementation based on Oat++ object-mapping sub-framework.
https://oatpp.io/
Apache License 2.0
6 stars 4 forks source link

API question #8

Closed clarkholdham closed 2 years ago

clarkholdham commented 2 years ago

In file: oatpp-mongo/bson/Types.hpp

Question

Hi there, we are using BODY_DTO(oatpp::Any, value) to capture raw json into our endpoints but having issues with quotes around JSON. We would like to use our own json formats and objects (not DTOs). Therefor we need to be able to retrieve raw json without being encapsulated in quotes. Is there a way to receive JSON in the body and push it into a string or another object type without wrapping the whole JSON object is quotes. For example we want to send: {"user":"admin"} instead of "{"user":"admin"}".

lganzzzo commented 2 years ago

Hello @clarkholdham ,

You can receive body as string:

  ENDPOINT("POST", "/", postBody, 
           BODY_STRING(String, body)) 
  {
    ...
  }
clarkholdham commented 2 years ago

Got it, thank you very much.