This project has moved and is read-only. For the latest updates, please go here.

[JsonIgnore] question

Jun 30, 2008 at 3:25 AM

I have a question about JsonIgnore attribute. I have a User object in server side looks like this:
Public class User
   public string UserId { get; set;}
   public string Passwd { get; set;}

It works fine when I use get from my XHR to load the user to client browser which I don't want expose password to the client side:
jsonString = JavaScriptConvert.SerializeObject<User>(user)

But when I try to create a user from client side, I do want the Passwd property pass back to server side when call:
User user = JavaScriptConvert.DeserializeObject<User>(jsonData)

Here the user.Passwd always is empty because JsonIgnore attribute althrough I set the Passwd property on javascript side.

Is there any way I can solve this in current 2.0 release? If not, can I submit this as a feature request?


Aug 4, 2008 at 10:19 AM
That isn't supported. In this sort of scenario where you are doing custom logic like this I would expect you would either write JSON yourself manually or write a JsonConverter for the User class.