Coder Social home page Coder Social logo

Comments (8)

kevin-montrose avatar kevin-montrose commented on August 19, 2024

@jbattermann You need to tell Jil to include inherited members. You can do this by either passing Options.IncludeInherited or by creating your own Options object with includeInherited:true to pass.

With Options.IncludeInherited passed on line 32 your gist will serialize to:

{"User":{"CreatedAtUtc":"\/Date(1388581200000)\/","DateOfBirth":"\/Date(315550800000)\/","UserId":1,"Username":"SomeUsername"}}

By default inherited fields aren't included as, at least for the roles Jil was envisioned for in my projects, it's often unwanted behavior. It's there if you need it though.

from jil.

joergbattermann avatar joergbattermann commented on August 19, 2024

Ah I see - thanks for the clarification. Good stuff. Thanks Kevin!

from jil.

joergbattermann avatar joergbattermann commented on August 19, 2024

@kevin-montrose one question regarding the same 'area':

Options.IncludeInherited did in fact add the inherited properties in the serialized Json, but it doesn't work the other way around - if I pass in the same Options to the .Deserialize(..) call, the nested property is returned as 'null'.

I've read over the documentation but saw nothing that would indicate why it's leaving out that property (but it does mention the originally overlooked Optiones.IncludeInherited, sorry for asking what was clearly indicated :-/).

I've updated the gist and marked the line (see https://gist.github.com/jbattermann/9589865db33742e2280b#file-deepobjectgraphtests-cs-L45), maybe you can give me a push in the right direction. Thanks!

from jil.

kevin-montrose avatar kevin-montrose commented on August 19, 2024

@jbattermann that may be an actual bug, I don't have time to dig in right this second but I'll try and set aside some time this week for it.

from jil.

joergbattermann avatar joergbattermann commented on August 19, 2024

Thanks @kevin-montrose , highly appreciated! Let me know if you need any more samples/input or whatsoever.

from jil.

manofstick avatar manofstick commented on August 19, 2024

Fix is here

from jil.

kevin-montrose avatar kevin-montrose commented on August 19, 2024

#76 merged in

from jil.

joergbattermann avatar joergbattermann commented on August 19, 2024

Thanks Kevin & @manofstick !

from jil.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.