public JSONObject toJson ( ) { JSONObject obj = new JSONObject ( ) . put ( OBJECT_LOCATION , new JSONObject ( ) . put ( "lat" , lat ) . put ( "lng" , lng ) ) . put ( STRING_NAME , name ) . put ( STRING_TYPES , new JSONArray ( types ) ) ; if ( accuracy != - 1 ) obj . put ( INTEGER_ACCURACY , accuracy ) ; if ( phoneNumber != null ) obj . put ( STRING_PHONE_NUMBER , phoneNumber ) ; if ( address != null ) obj . put ( STRING_ADDRESS , address ) ; if ( website != null ) obj . put ( STRING_WEBSITE , website ) ; if ( locale != null ) obj . put ( STRING_LANGUAGE , locale . getLanguage ( ) ) ; return obj ; }
Returns a Google formatted JSON object to be sent to Google s servers .