WIP Jsonifier!

About Monkey 2 Forums Monkey 2 Code Library WIP Jsonifier!

This topic contains 4 replies, has 4 voices, and was last updated by  regulark 9 months, 3 weeks ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #13671

    Mark Sibly
    Keymaster

    Here’s my first attempt at a new ‘jsonifier’ system for converting data to/from json.

    You’ll need a bleeding edge build of develop branch for the TypeInfo.NullValue feature.

    This will eventually end up in the std module (there’s already the start of a jsonifier in there but that”ll go).

    This demo shows the basic idea including the ability to jsonify cyclic data.

    #13682

    scurty
    Participant

    Ooo! Is it possible to add blobs? (Basically just Databuffers) for adding any value? Like New JsonBlob(New DataBuffer(20))
    Then we can save images, files, or really anything into a Json File. Would be amazingly convenient for sending data through TCP.
    Great work Mark. 😀

    So far I’m just converting a PNG to a JsonString and back again using a modified version of Nerobots datapacker.

    #13714

    Ethernaut
    Participant

    Awesome! Time to scrap my w.i.p. serializer module. Good riddance…

    #13728

    Mark Sibly
    Keymaster

    > Ooo! Is it possible to add blobs?

    Json doesn’t support ‘blobs’, but you can roll your own.

    For example, the gltf format allows you to use ‘data:’ URLs, and has an ‘accessor’ system that allows for data to be stored in external files. These aren’t actually part of json, but implemented ‘on top of’ json. I don’t see why we can’t implement/steal similar systems though.

    Here’s a new WIP version that features an attempt at serializing constructors. Really rough and there’s lots to sort out here but it’s looking promising. Note that the LoadC and CreateC functions are really just ‘encapsulating’ the function call ‘C.Load( path:String )’ and the simple ctor ‘New C( Vec2i )’. I have  no idea how this still will be implemented in practice yet though!

    #13787

    regulark
    Participant

    I was hoping to see this come around sometime, it will be quite useful. Thank you!

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.