Customizing Json.NET serialization: turning object into array to avoid repetition of property names

前端 未结 6 1609
半阙折子戏
半阙折子戏 2020-12-30 00:11

I\'m sending large amounts of different JSON graphs from a server to a client (I control both) and they all contain a pathological case: a large array of homogeneous (same t

6条回答
  •  伪装坚强ぢ
    2020-12-30 00:17

    To answer your first question: yes, someone already built this and called it 'jsonh'.

    Bad thing about it is: it's not available for c# but you have enough code there to implement it yourself... I have not yet seen it as a ready made package for C# anywhere

    and then there is another "standard" that almost does this, but is meant for exactly the same: rjson

    And again: no C#...

    If you just (g)zip your json data, it will automatically achieve the kind of compression you want (but better) since, as you already stated huffman, it uses a huffman tree. And the idea behind jsonh and rjson is to avoid duplication in the keys, while gzip would make a difference between keys, values or other glyphs.

提交回复
热议问题