-
Notifications
You must be signed in to change notification settings - Fork 464
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
Adding to JsonNetSerializer ctor accepting JsonSerializer #120
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@PureKrome will this work for you? |
/// <inheritdoc /> | ||
public string Serialize(object obj) | ||
{ | ||
return JObject.FromObject(obj, _serializer).ToString(Formatting.None); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would the Formatting.None
override any formatting settings in the _serializer
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IDK. Can you please try with your settings and see whether it works?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PureKrome ping
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Appols - RL > everything else right now. I'll give it a crack, tonight. watch this space :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@abatishchev I feel like the formatting is ignored during the FromObject
stage. And unfortunately, needs to be applied to the ToString()
stage.
so ...
return JObject.FromObject(obj, _serializer).ToString(_serializer.Formatting);
BUT! because of me checking out that overload in the ToString()
.. there's also a converters input param... which means this is also valid.
return JObject.FromObject(obj, _serializer).ToString(_serializer.Formatting, _serializer.Converters.ToArray());
This is me testing various permutations over the last 30-60 mins.
I've also ref'd these:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh . that said ...
I couldn't find an online token decoder that RESPECTED the json formatting which was encoded into the JWT. All the online decoders I think formatted the json nicely for me (which makes all of this testing, hardish)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check it out now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM 👍 I'm hoping the additions are actually worth it to other people 😊
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One can only hope :-D
_serializer = serializer ?? throw new ArgumentNullException(nameof(serializer)); | ||
} | ||
|
||
/// <inheritdoc /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL: inheritdoc
👍
Pushed to NuGet as 3.0.0 |
@nbarbettini do you know how it happened that nuget dependency on json.net is now 10.0.2? Thought it's 6.0.4 (the one that the latest WebApi and MVC have). |
it's been v9 and v10 for a bit.... |
I set it to 10.0.2 in #72, but it looks like it was already there before (in the old project file). |
It seems that v3 always targeted v10 while v2 targets v6 |
I think it was here? dd35710#diff-091a88bfcd5c1e8f92f4596998c71e86 (at least 9 -> 10) |
I just might forget. IIRC we were discussing building against the latest version. So it got propagated into the nuspec automatically. But I'd still require not more than 6.0.4 go give people more choices, do not force 10.0 without real need. |
Folks, do you know how binary reference the latest but nuget reference the lowest? |
I don't know how to do it in .NET Standard, sorry. |
Addresses #119.
<inheritdoc />