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

Guid conversion to JSON is unquoted #166

Closed
replaysMike opened this issue Feb 18, 2016 · 2 comments
Closed

Guid conversion to JSON is unquoted #166

replaysMike opened this issue Feb 18, 2016 · 2 comments

Comments

@replaysMike
Copy link

When converting from YAML to JSON, the GuidConverter is not handling Guid's correctly. They must be quoted strings according to JSON spec.

var js = new Serializer(SerializationOptions.JsonCompatible | SerializationOptions.DisableAliases, namingConvention: new CamelCaseNamingConvention());

using (var w = new StringWriter())
{
    js.Serialize(w, o);
    string json = w.ToString();

    /*Fix for issue #165, duplicate backslashes produced by YamlDotNet */
    json = json.Replace(@"\\", @"\");

    return json;
}

@aaubry
Copy link
Owner

aaubry commented Feb 29, 2016

I confirm that this is a bug; I'll see what can be done to fix it.

@aaubry aaubry closed this as completed in f3bcdf1 Feb 29, 2016
@replaysMike
Copy link
Author

awesome thanks. I thought this might have been happening in the underlying json library as microsoft's javascript serialize also behaves this way, but I didn't check to see if you had rolled your own.

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