1

I have this class :

public class DesignElements
{
    public List<DesignElement> Elements;
    public bool Front { set; get; }
    public string ThemeID { set; get; }


    public DesignElements()
    {
       Elements = new List<DesignElement>();
    }
}

result of serializing this class to page is :

var json=
         {
            "Elements":
               [
                {"Alignment":null,"Bold":false},
                {"Alignment":null,"Bold":false}
               ],
               "Front":true,
                "ThemeID":"9"
        };

problem is sending this json in page to web-service with jQuery

  1. should I use the JSON.stringify method and sent it as as string ? if yes what is the name of argument in web-service ?

  2. can I send json as DesignElements object to web-service. if yes what is the name of Argument in web-service ?

Mironline
  • 2,755
  • 7
  • 35
  • 61

1 Answers1

3

as I got in the some search specially in Jquery Ajax Posting json to webservice

First I have to convert my object to JSON :

data: {DesignElements : JSON.stringify(json)}

and post it to webserivce

    [WebMethod]
    public void SaveJson(DesignElements DesignElements)
    {
    }
Community
  • 1
  • 1
Mironline
  • 2,755
  • 7
  • 35
  • 61