0

In my project I have to send a very specific JSON Request to an oracle server to receive a response; at the moment I am sending the json string :

{\"id\":\"1\",\"method\":\"getOverviewInfo\",\"Params\":{\"overviewID\":\"0000004297\",\"overviewType\":\"Stock Items\",\"AORParams\":null,\"arrOptions\":{\"columnInfo\":\"1;100;1;1#\",\"orderInfo\":\"1;0;0#\"}}}" Coming from this class :

public class SendOverview    {              

public string id   { get; set;}
                public string method { get; set;}
                public SendOV Params {get; set;}
    }

 public class SendOV    {               

public string overviewID { get; set; }
        public string overviewType { get; set; }
        public string AORParams { get; set; }
        public SentDatas arrOptions { get; set; }

    }   

public class SentDatas    {       

public string columnInfo { get; set; }
        public string orderInfo { get; set; }
    }

Now my question is, can I possibly adjust the request string to remove the member names from the Params array, so instead of "overviewID" = "xxxx","overviewType" = "xxxx".......

It should be "xxxx","xxxx"

EDIT FORMATTED:

{
    "id": "1",
    "method": "getOverviewInfo",
    "Params": {
        "0000004297",
        "Stock Items",
        null,
        {
            "columnInfo": "1;100;1;1#",
            "orderInfo": "1;0;0#"
        }
    }
}
Govind Malviya
  • 13,627
  • 17
  • 68
  • 94
NoxBene
  • 94
  • 1
  • 12
  • The problem herein lays that I have no clue how to serialise a multi-object array, even create it .. – NoxBene Apr 16 '12 at 13:58

1 Answers1

0

Yes you could do something like that, you need to replace the object {} with array [] for the value of the params if you do it though.

Like:

{
    "id": "1",
    "method": "getOverviewInfo",
    "Params": [
        "0000004297",
        "Stock Items",
        null,
        {
            "columnInfo": "1;100;1;1#",
            "orderInfo": "1;0;0#"
        }
    ]
}

I'm assuming your reason for wanting to do that is transfer size. The endpoint your sending to will still need to know how to read that request, if it supports positional parameters like above, you will need to ensure they are positioned in the correct order, and stay constant.

Austin Harris
  • 1,676
  • 1
  • 17
  • 22