Skip to content

json is not serialized in order format #1

@Rajeshkumar123

Description

@Rajeshkumar123

I tried your class for serializing the object to XML. I am facing one problem. While serializing my xml tags are not in order format. Due to that I am getting error when I try to send the SOAP request.

My wrapper class

public class FedexRequestJSON {
	public cls_ProcessShipmentRequest ProcessShipmentRequest;
    
	public class cls_ProcessShipmentRequest {
		public cls_WebAuthenticationDetail WebAuthenticationDetail;
		public cls_ClientDetail ClientDetail;
		public cls_TransactionDetail TransactionDetail;
		public cls_Version Version;
		public cls_RequestedShipment RequestedShipment;
	}
}

My Output on JSON Serialize(I didn't post the complete output just a sample to show how the order was changed)

{
  "ProcessShipmentRequest" : {
    "WebAuthenticationDetail" : {
      "UserCredential" : {
        "Password" : "**",
        "Key" : "***"
      }
    },
    "Version" : {
      "ServiceId" : "ship",
      "Minor" : 0,
      "Major" : 23,
      "Intermediate" : 0
    },

Is it possible to serialize the same order like in Wrapper class order.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions