jgomezal
jgomezal
CC#
Created by jgomezal on 8/23/2023 in #help
✅ An API refuses my Connection from MAC but not Windows.
31 replies
CC#
Created by jgomezal on 2/1/2023 in #help
❔ Calling files Path inside the project (MAC and Windows"
Hello there. It's a totally beginner question, for understanding how the compilation works. I have this folder structure: project |- Folder: Classes |- Folder: Exports (here I'm downloading the API result) |- Folder: MasterData (here there is a .csv file) - File: project.cs I know in MAC the files structure is "./MasterData/file.csv", and that Microsoft structure is ".\MasterData\file.csv". Questions: 1. Once I compile the console application, will it recognize the file structure for whatever OS? 2. Must I include both path structures in the code with an if statement that confirms if the path exist? Thanks a lot!
16 replies
CC#
Created by jgomezal on 1/28/2023 in #help
✅ [RESOLVED] Newtonsoft :: wrong serialization format
Dear all, I'm requesting your help, because I don't understand what I'm doing wrong.
string operations = "{\"inumoper\": \"44444\", \"itdoper\": \"ORD1\"}";

Dictionary<string, string> objParams = new Dictionary<string, string>
{
{"accion", "LOAD" },
{"operaciones", operations},
};

string[] arrParams = new string[4];
arrParams[0] = JsonConvert.SerializeObject(objParams, Formatting.None);
arrParams[1] = "123456789";
arrParams[2] = "1001";
arrParams[3] = "0";

Dictionary<string, Array> objSend = new Dictionary<string, Array>
{
{"_parameters", arrParams }
};
string operations = "{\"inumoper\": \"44444\", \"itdoper\": \"ORD1\"}";

Dictionary<string, string> objParams = new Dictionary<string, string>
{
{"accion", "LOAD" },
{"operaciones", operations},
};

string[] arrParams = new string[4];
arrParams[0] = JsonConvert.SerializeObject(objParams, Formatting.None);
arrParams[1] = "123456789";
arrParams[2] = "1001";
arrParams[3] = "0";

Dictionary<string, Array> objSend = new Dictionary<string, Array>
{
{"_parameters", arrParams }
};
` I need this data with this format:
"{\"_parameters\":[{\"accion\":\"LOAD\",\"operaciones\":[{\"inumoper\":\"44444\",\"itdoper\":\"ORD1\"}]},\"123456789\",\"1001\",\"0\"]}"
"{\"_parameters\":[{\"accion\":\"LOAD\",\"operaciones\":[{\"inumoper\":\"44444\",\"itdoper\":\"ORD1\"}]},\"123456789\",\"1001\",\"0\"]}"
But I'm getting it like this:
"{\"_parameters\":["{\"accion\":\"LOAD\",\"operaciones\":\"{\\\"inumoper\\\": \\\"44444\\\", \\\"itdoper\\\": \\\"ORD1\\\"}\"}"]},\"123456789\",\"1001\",\"0\"]}"
"{\"_parameters\":["{\"accion\":\"LOAD\",\"operaciones\":\"{\\\"inumoper\\\": \\\"44444\\\", \\\"itdoper\\\": \\\"ORD1\\\"}\"}"]},\"123456789\",\"1001\",\"0\"]}"
` As you see, in the "operaciones" array, I'm receiving an escape for a backslash and I don't need it. Do you know how can I solve it? Thanks in advance, Migue
19 replies