urbanairship-core/src/main/java/com/urbanairship/push/ChannelRegistrationPayload.java
static ChannelRegistrationPayload parseJson(JsonValue jsonValue) throws JsonException {
        JsonMap jsonMap = jsonValue.optMap();
        JsonMap channelJson = jsonMap.opt(CHANNEL_KEY).optMap();
        JsonMap identityHints = jsonMap.opt(IDENTITY_HINTS_KEY).optMap();

        if (channelJson.isEmpty() && identityHints.isEmpty()) {
            throw new JsonException("Invalid channel payload: " + jsonValue);
        }

        Set<String> tags = new HashSet<>();
        for (JsonValue tag : channelJson.opt(TAGS_KEY).optList()) {
            if (tag.isString()) {
                tags.add(tag.getString());
            } else {
                throw new JsonException("Invalid tag: " + tag);
            }
        }

        return new Builder().setOptIn(channelJson.opt(OPT_IN_KEY).getBoolean(false))
                            .setBackgroundEnabled(channelJson.opt(BACKGROUND_ENABLED_KEY).getBoolean(false))
                            .setDeviceType(channelJson.opt(DEVICE_TYPE_KEY).getString())
                            .setPushAddress(channelJson.opt(PUSH_ADDRESS_KEY).getString())
                            .setAlias(channelJson.opt(ALIAS_KEY).getString())
                            .setLanguage(channelJson.opt(LANGUAGE_KEY).getString())
                            .setCountry(channelJson.opt(COUNTRY_KEY).getString())
                            .setTimezone(channelJson.opt(TIMEZONE_KEY).getString())
                            .setTags(channelJson.opt(SET_TAGS_KEY).getBoolean(false), tags)
                            .setUserId(identityHints.opt(USER_ID_KEY).getString())
                            .setApid(identityHints.opt(APID_KEY).getString())
                            .build();
    }
/**
     * Creates a ChannelRegistrationPayload from JSON object
     *
     * @param jsonValue The JSON object to create the ChannelRegistrationPayload from
     * @return The payload as a ChannelRegistrationPayload
     */
Creates a ChannelRegistrationPayload from JSON object
@param jsonValue The JSON object to create the ChannelRegistrationPayload from
@return The payload as a ChannelRegistrationPayload
Creates a ChannelRegistrationPayload from JSON object @param jsonValue The JSON object to create the ChannelRegistrationPayload from @return The payload as a ChannelRegistrationPayload
static ChannelRegistrationPayload parseJson(JsonValue jsonValue) throws JsonException {
        JsonMap jsonMap = jsonValue.optMap();
        JsonMap channelJson = jsonMap.opt(CHANNEL_KEY).optMap();
        JsonMap identityHints = jsonMap.opt(IDENTITY_HINTS_KEY).optMap();
        if (channelJson.isEmpty() && identityHints.isEmpty()) {
            throw new JsonException("Invalid channel payload: " + jsonValue);
        }
        Set<String> tags = new HashSet<>();
        for (JsonValue tag : channelJson.opt(TAGS_KEY).optList()) {
            if (tag.isString()) {
                tags.add(tag.getString());
            } else {
                throw new JsonException("Invalid tag: " + tag);
            }
        }
        return new Builder().setOptIn(channelJson.opt(OPT_IN_KEY).getBoolean(false))
                            .setBackgroundEnabled(channelJson.opt(BACKGROUND_ENABLED_KEY).getBoolean(false))
                            .setDeviceType(channelJson.opt(DEVICE_TYPE_KEY).getString())
                            .setPushAddress(channelJson.opt(PUSH_ADDRESS_KEY).getString())
                            .setAlias(channelJson.opt(ALIAS_KEY).getString())
                            .setLanguage(channelJson.opt(LANGUAGE_KEY).getString())
                            .setCountry(channelJson.opt(COUNTRY_KEY).getString())
                            .setTimezone(channelJson.opt(TIMEZONE_KEY).getString())
                            .setTags(channelJson.opt(SET_TAGS_KEY).getBoolean(false), tags)
                            .setUserId(identityHints.opt(USER_ID_KEY).getString())
                            .setApid(identityHints.opt(APID_KEY).getString())
                            .build();
    }
static ChannelRegistrationPayload parseJson ( JsonValue jsonValue ) throws JsonException { JsonMap jsonMap = jsonValue . optMap ( ) ; JsonMap channelJson = jsonMap . opt ( CHANNEL_KEY ) . optMap ( ) ; JsonMap identityHints = jsonMap . opt ( IDENTITY_HINTS_KEY ) . optMap ( ) ; if ( channelJson . isEmpty ( ) && identityHints . isEmpty ( ) ) { throw new JsonException ( "Invalid channel payload: " + jsonValue ) ; } Set < String > tags = new HashSet < > ( ) ; for ( JsonValue tag : channelJson . opt ( TAGS_KEY ) . optList ( ) ) { if ( tag . isString ( ) ) { tags . add ( tag . getString ( ) ) ; } else { throw new JsonException ( "Invalid tag: " + tag ) ; } } return new Builder ( ) . setOptIn ( channelJson . opt ( OPT_IN_KEY ) . getBoolean ( false ) ) . setBackgroundEnabled ( channelJson . opt ( BACKGROUND_ENABLED_KEY ) . getBoolean ( false ) ) . setDeviceType ( channelJson . opt ( DEVICE_TYPE_KEY ) . getString ( ) ) . setPushAddress ( channelJson . opt ( PUSH_ADDRESS_KEY ) . getString ( ) ) . setAlias ( channelJson . opt ( ALIAS_KEY ) . getString ( ) ) . setLanguage ( channelJson . opt ( LANGUAGE_KEY ) . getString ( ) ) . setCountry ( channelJson . opt ( COUNTRY_KEY ) . getString ( ) ) . setTimezone ( channelJson . opt ( TIMEZONE_KEY ) . getString ( ) ) . setTags ( channelJson . opt ( SET_TAGS_KEY ) . getBoolean ( false ) , tags ) . setUserId ( identityHints . opt ( USER_ID_KEY ) . getString ( ) ) . setApid ( identityHints . opt ( APID_KEY ) . getString ( ) ) . build ( ) ; }
Creates a ChannelRegistrationPayload from JSON object
 @param jsonValue The JSON object to create the ChannelRegistrationPayload from
 @return The payload as a ChannelRegistrationPayload
Creates a ChannelRegistrationPayload from JSON object @param jsonValue The JSON object to create the ChannelRegistrationPayload from @return The payload as a ChannelRegistrationPayload