Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xamarin SerializeObject returns {} #1578

Closed
cboyce428 opened this issue Jan 14, 2018 · 1 comment
Closed

Xamarin SerializeObject returns {} #1578

cboyce428 opened this issue Jan 14, 2018 · 1 comment

Comments

@cboyce428
Copy link

Xamarin.Forms project when serializing an object the json returned is "{}" when running via the live player (android):

[Preserve(AllMembers = true)]
[JsonObject(MemberSerialization.OptOut)]
public class Author
{
    public int Id;
    public string Name;
}

        Author mmm = new Author
        {
            Id = 100,
            Name = "asdjasd"
        };
        string json = JsonConvert.SerializeObject(mmm);

        DisplayAlert("Dialog Title", json, "Ok", "Cancel");

Originally reported here:
https://stackoverflow.com/questions/48041823/jsonconvert-serializeobject-always-return-in-xamarinforms

@cboyce428
Copy link
Author

This appears to be a problem with the live player, if I compile it to an APK it works fine on the actual device.

@JamesNK JamesNK closed this as completed Jan 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants