ALLOW_UNQUOTED_FIELD_NAMES in jackon JSON library

后端 未结 4 838
时光说笑
时光说笑 2020-12-06 10:01

I\'m using the jackson library for serializing/deserializing to/from JSON. I need that this JSON has the smallest size as possible so I\'ve enabled the feature ALLOW_UNQUOT

4条回答
  •  我在风中等你
    2020-12-06 10:29

    Seems like Jackson with QUOTE_FIELD_NAMES in certain cases produces such output that it can't read itself even with ALLOW_UNQUOTED_FIELD_NAMES on. You will probably need to implement custom JsonParser for non-standard input parsing.

    The problem is that you're generating non-standard JSON and there's no guarantees that client will handle it properly. However if you don't expose it outside your application(s) and care about size much you could parse/generate binary format like Jackson's Smile. See http://www.cowtowncoder.com/blog/archives/2010/09/entry_418.html (2.4).

提交回复
热议问题