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

Serialize the dynamic object. #62

Closed
seanmars opened this issue Aug 22, 2018 · 2 comments
Closed

Serialize the dynamic object. #62

seanmars opened this issue Aug 22, 2018 · 2 comments
Labels

Comments

@seanmars
Copy link

seanmars commented Aug 22, 2018

It will get the non-yaml string when serialize the dynamic object.

dynamic o = new ExpandoObject();
o.name = "foo";
var serializer = new Serializer();
System.Console.WriteLine(serializer.Serialize(o));

will get

!System.Dynamic.ExpandoObject,%2520System.Linq.Expressions,%2520Version=4.2.1.0,%2520Culture=neutral,%2520PublicKeyToken=b03f5f7f11d50a3a
name: foo

Env(dotnet --info):

.NET Core SDK (reflecting any global.json):
 Version:   2.1.400
 Commit:    8642e60a0f

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.13
 OS Platform: Darwin
 RID:         osx.10.13-x64
 Base Path:   /usr/local/share/dotnet/sdk/2.1.400/

Host (useful for support):
  Version: 2.1.2
  Commit:  811c3ce6c0

.NET Core SDKs installed:
  2.1.400 [/usr/local/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
@xoofx
Copy link
Owner

xoofx commented Aug 22, 2018

yes. This is by design. The system has to be able to deserialize from it. Otherwise you need to specify the type of the expando object to the Serialize method (something like Serializer.Serialize(o, typeof(DynamicObject))), so that it won't dump anything.

@xoofx xoofx closed this as completed Aug 22, 2018
@xoofx xoofx added the wontfix label Aug 22, 2018
@seanmars
Copy link
Author

Thank you for your explanation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants