Skip to content

Instantly share code, notes, and snippets.

@ryanlowdermilk
Created January 26, 2012 06:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanlowdermilk/1681337 to your computer and use it in GitHub Desktop.
Save ryanlowdermilk/1681337 to your computer and use it in GitHub Desktop.
var customer = new Customer { Name="Joe Bloggs", Age=31 };
var json = JsonSerializer.SerializeToString(customer);
var fromJson = JsonSerializer.DeserializeFromString<Customer>(json);
@mythz
Copy link

mythz commented Jan 26, 2012

What's the StackTrace?

@ryanlowdermilk
Copy link
Author

at ServiceStack.Text.JsonSerializer.SerializeToString[T](User value)
at IdeaStrike.library.IdeaWebRequest.Send(User user)
at IdeaStrike.library.IdeaActions.VoteUp(User user)
at IdeaStrike.library.IdeaAction.VoteUp(User user)
at IdeaStrike.client.phone.App.Application_Launching(Object sender, LaunchingEventArgs e)
at Microsoft.Phone.Shell.PhoneApplicationService.FireLaunching()
at Microsoft.Phone.Execution.NativeEmInterop.FireOnLaunching()

@mythz
Copy link

mythz commented Jan 26, 2012

Looks like you're trying to use it in WP7?
I'd look at using this older port, someone else did a while ago:
http://csainty.blogspot.com/2011/10/using-servicestacktext-for-json.html

@ryanlowdermilk
Copy link
Author

Yup - you're right. I called my Portable Class Library from a Console app and the above code worked just fine. Interesting. The Portable Class Library should work fine on Windows, Xbox and Phone.

Thanks for the help @mythz!!!

@ryanlowdermilk
Copy link
Author

Yup - you're right. I called my Portable Class Library from a Console app and the above code worked just fine. Interesting. The Portable Class Library should work fine on Windows, Xbox and Phone.

Thanks for the help @mythz!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment