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

Possible Suggestion/Feature for JSONIgnore #445

Closed
ghost opened this issue Dec 15, 2014 · 3 comments
Closed

Possible Suggestion/Feature for JSONIgnore #445

ghost opened this issue Dec 15, 2014 · 3 comments

Comments

@ghost
Copy link

ghost commented Dec 15, 2014

Hi,
I'm having a bit of a dillemma with something that uses Newtonsoft json in it's own code. I want to filter a property from it's use of the newtonsoft json serializer, but not mine:

basho/riak-dotnet-client#222

I was thinking it'd be nice if there was a way to pass the typeof(class) where I want the JSONIgnore attribute to be used, though I'm trying to think of a way you could do that and I can't really unless you were to unwind the stack with System.Diagnostics.StackTrace or something awful. Hopefully they will come up with their own parser, I'm actually trying to make one but having trouble figuring out how to do it, I'll take a look at how you guys did it and see if thats any better, it'd be nice if I didn't have to rewrite the full blown JsonConverter abstract members though just to do something as simple as:

if(value.GetType().GetCustomAttributes().All(a => a.GetType() != typeof(RiakIgnore)))
{

} 
@ghost
Copy link
Author

ghost commented Dec 15, 2014

I don't know. I thought maybe even an extension overload or something for SerializeObject but I can't really see a way, help appreciated

@JamesNK
Copy link
Owner

JamesNK commented Dec 19, 2014

You can do this using a contract resolver.

@JamesNK JamesNK closed this as completed Dec 19, 2014
@ghost
Copy link
Author

ghost commented Jan 15, 2015

Thanks, I guess that'll do :)

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

1 participant