I'm using JsonSerializer to convert an Object to a JSON String but the order is wrong. The attributes are automatically sorted alphabetically but I want them in the order they have been listed in the class (e.g. "endPoint" should not appear before "startPoint").
When I call JsonSerializer. I only see 4 methods (toJava or toJson). I tried doing includes with the order but it doesn't work/I'm not doing it right. The way I'm doing it is like this:
return new String[]{"errorDescription", "searchResultRecord.billOfLadingNumber",
"searchResultRecord.bookingNumber", "searchResultRecord.advancedManifest",
"searchResultRecord.inboundCustomsClearanceStatus", "searchResultRecord.cargoReleaseStatus", "searchResultRecord.freightChargeReleaseStatus",
"searchResultRecord.container.containerNumber", "searchResultRecord.container.latestEvent.event",
"searchResultRecord.container.latestEvent.location", "searchResultRecord.container.latestEvent.time"};
As you can see there is obj.obj.attr parts being included. But when I try to run this code I only see "errorDescription" in the output string. I then tried "searchResultRecord" without attributes but it only showed 2 of the attributes in the output :x
Any idea how to fix the order so its not alphabetical? All examples online seem to be from an older version of the class with more accessible methods~ Thanks for any info.