Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
Hi can anyone help me with json serializer and nhibernate, i want to tell json how deep he should go with serialization something like :
Employess=>Company=>Job
and i wanna serialize only
Employess=>Company and here the break for json.
Generally you want to create a DTO object whose responsibility is knowing how to serialize itself out. It shouldn't really be the responsibility of the nhibernate object to know how to translate itself in to something that the json consumer needs.
Add a comment
You should decorate the Job property with [JsonIgnore] attribute.
Job
[JsonIgnore]
[JsonIgonre] public <JobType> Job {get; set;}
This way the serializer will ignore this property. You will need to add the proper using statement to your class header.
using
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.