Skip to content

Json get should return option instead of null #158

@angeloh

Description

@angeloh

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()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions