play json in scala: deserializing json with unknown fields without losing them
问题 consider i have a json as following: { "a": "aa", "b": "bb", "c": "cc", "d": "dd", // unknown in advance "e": { //unknown in advance "aa": "aa" } } i know for sure that the json will contain a,b,c but i've no idea what other fields this json may contain. i want to serialize this JSON into a case class containing a,b,c but on the other hand not to lose the other fields (save them in a map so the class will be deserialized to the same json as received). ideas? 回答1: One option is to capture the