Serialize JSON - "OptimizedAttributes" issue

Hello everyone,

We're trying to integrate with JIRA's Cloud API, and our client wants to do all the connection and serialize work on a custom .Net extension.

However, we're struggling with the serialized structure that is generated by the .Net class. 

We receive a structure named ssCreateIssue which come from Outsystems and has few parameters inside.

The code below displays how we're doing the serialization:

string json = JsonConvert.SerializeObject(ssCreateIssue, Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });

The Json that is generated by this JsonConvert method has a lot of unwanted parameters named "OptimizedAttributes" that we think are blocking the correct integration with JIRA's cloud:

{
  "ssSTfields": {
    "ssproject": {
      "ssSTproject3": {
        "ssid": 10025,
        "OptimizedAttributes": null
      },
      "OptimizedAttributes": null
    },
    "sssummary": "Sumario issue JC",
    "ssdescription": {
      "ssSTdescription": {
        "sstype": "doc",
        "ssversion": 1,
        "sscontent": [],
        "OptimizedAttributes": null
      },
      "OptimizedAttributes": null
    },
    "ssissuetype": {
      "ssSTissuetype1": {
        "ssname": "Task",
        "OptimizedAttributes": null
      },
      "OptimizedAttributes": null
    },
    "OptimizedAttributes": null
  },
  "OptimizedAttributes": null
}


Does anyone ever had this "OptimizedAttributes" being injected into a JSON structure?


Thank you for your help.

Best regards,

Diogo Pedreira

Hi, unless you want to fix this on a .net side you can go with a quick workaround on Outsystems side by setting up onresponse event and modifying the JSON if this is REST api or just assign if this is an extension. You can use regex replace function to remove unnecessary pieces.  

Hi Diogo,

You cannot serialize an Outsystems Structure in .NET like that. What your client wants is silly. OutSystems is perfectly capable of integrating with JIRA without an Extension (see e.g. this blog post and this Forge Component). OutSystems is a low-code Platform, using it to integrate with loads of high-code just doesn't make sense.

Hello,


Thank you both for your inputs.


@Roman, thank you but we really need to do all this "work" inside a .Net extension.


@Kilian, thank you. We suggested those solutions as well, but client needs to save AOs, hence the need to create all these JIRA's Cloud integrations inside an extension... We're trying to draw a solution that can meet a solution's between client's needs and the complexity of doing everything inside .Net extension. 


We think we found the possible reason for the creation of those "OptimizedAttributes", we're finalising some tests to be sure about it.


Thank you all.

Best regards,

Diogo

If it's just "saving AOs", I don't think using the platform's JSON Serialize counts as extra AOs?

Using the "JsonConvert.SerializeObject(" over the record objects takes advantage of platform internals, that it not supported and can easily lead you into problems if the internal representations of the objects change for some reason.

Like Kilian said you should do the json serialization using the platform builtin JSON Serialize capabilities and pass that to the extension already serialized. If you really don't wan't to do that, then create an object inside the extension with the exact representation that you need an then convert the structure to that object before serializing it.


Regards,
João Rosado

Hello,


@Kilian, indeed it does not count as an AO, however, Client would like to keep doing all the process and serialization inside the .net extension.


@João, thank you for your input, and we are totally agree with your and Kilian's opinion.. We would just want to see if someone had already a fix for this "issue". Thank you all.


Best regards,

Diogo Pedreira