Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Json get should return option instead of null #158

Open
angeloh opened this issue May 14, 2014 · 1 comment
Open

Json get should return option instead of null #158

angeloh opened this issue May 14, 2014 · 1 comment

Comments

@angeloh
Copy link
Contributor

angeloh commented May 14, 2014

This is my json looks like:

{"address":"eb.local2","body":{"status":"ok","result":{"memberId":"memberid1","sys_pres":"connected","presence":"Online"}}}

It is really difficult to test a value in a deeper level.

if (json.getObject("body") != null && json.getObject("body").getObject("result") != null &&
                json.getObject("body").getObject("result").getString("presence") != null &&                json.getObject("body").getObject("result").getString("presence").equals("Online"))
dosomething()
@galderz
Copy link
Contributor

galderz commented May 23, 2014

Yeah, our current JSON API is essentially the same as the Java API. This is something we'll be looking to rectify for 2.0. Rather coming up with a new JSON API within Scala, we might look into existing functional libraries to handle JSON, such as Argonaut (http://argonaut.io/).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants