JSON to Java Objects, best practice for modeling the json stream

后端 未结 3 1352
心在旅途
心在旅途 2021-01-20 17:58

I have a JSON stream being generated by a server side C++ program that is currently in development. I\'ve been given a sample of the resulting JSON and I am concerned that I

3条回答
  •  深忆病人
    2021-01-20 18:38

    No this isn't particularly hard to deserialize into Java objects. JSON doesn't have many clues about typing information other than their primitives. Most of the concern about loosing type information can be recovered either by looking at the object you want to deserialize into, or have the user provide the object they want to deserialize into. That's precisely how flexjson works, and you have a lot of flexibility to define at each point how to deserialize it. It comes with sensible defaults for most problems, but you can always attach an ObjectFactory to specific class or path with in the JSON stream.

    http://flexjson.sourceforge.net

提交回复
热议问题