简体   繁体   中英

Play Framework: Problems migrating from version 2.3.x to 2.4.1

I'm migrating my Play application from version 2.3.8 to version 2.4.1... and I'm encountering some problems with JSON.

The main issue is that now obj \\ key returns a JsLookupResult and statements like Json.arr(obj \\ key, 1) fail because Json.arr expects a JsValueWrapper .

How do I fix this issue?

If you are certain that \\ will not fail, you can just call .get on it, as you would an Option .

Json.arr( (obj \\ key).get, 1)

Needless to say, there are other operands like getOrElse that can provide a default value in case obj has no key .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM