I am creating an ASP.NET Core Web API that stores and retrieves data from a SQL database. One particular endpoint will take a JSON object, however, this particular JSON object will represent the contents of a JSON configuration file. So, the JSON object being sent across the wire will look like this:
{
"userID": 123,
"jsonFileName" : "aUserConfigFile.json",
"jsonFileData" : " ...some dynamic json string... "
}
Where the jsonFileData will be dynamic in length depending on user choices. Just imagine a typical JSON file where there is lots of different bits of data in it.
The caller that will be calling this ASP.NET Core Web API will be a C++ app. The JSON object gets stored in a SQL database.
Also, there is the flip side, where I will need to be able to return this same data back to the calling C++ app.
I've tried to send the jsonFileData to the API using Swagger, but I get bad request errors all pointing to the jsonFileData string.
I guess my question would be: what kind of text treatment can I use on this string to make it usable to send into the API?
SerializeObjector something like that? So use that to set thejsonFileDataproperty. When you serialize the containing object,SerializeObject(or whatever) will presumably take care of anything that needs to be done to the string value in JSON so that it survives the serialization and deserialization.