Example usage for org.json JSONArray toString

List of usage examples for org.json JSONArray toString

Introduction

In this page you can find the example usage for org.json JSONArray toString.

Prototype

public String toString() 

Source Link

Document

Make a JSON text of this JSONArray.

Usage

From source file:com.battlelancer.seriesguide.extensions.ExtensionManager.java

private synchronized void saveSubscriptions() {
    List<String> serializedSubscriptions = new ArrayList<>();
    for (ComponentName extension : mEnabledExtensions) {
        serializedSubscriptions.add(extension.flattenToShortString() + "|" + mSubscriptions.get(extension));
    }//from   w ww. j ava 2  s .  c  om
    Timber.d("Saving " + serializedSubscriptions.size() + " subscriptions");
    JSONArray json = new JSONArray(serializedSubscriptions);
    mSharedPrefs.edit().putString(PREF_SUBSCRIPTIONS, json.toString()).apply();
}

From source file:com.mmclass.libsiren.Util.java

public static void putFloatArray(Editor editor, String key, float[] array) {
    try {//from w  w  w . j a  v a2  s .  c o m
        JSONArray json = new JSONArray();
        for (float f : array)
            json.put(f);
        editor.putString("equalizer_values", json.toString());
    } catch (JSONException e) {
        e.printStackTrace();
    }
}

From source file:com.abeo.tia.noordin.ProcessCaseLoanPrincipal.java

private void confirm_allvalues_btn() throws JSONException {
    // TODO Auto-generated method stub

    String json_element = "[{\"Case\":" + "\"" + jsonResponseconfirm.get("Case").toString() + "\",\"CaseType\":"
            + "\"" + jsonResponseconfirm.get("CaseType").toString()
            + "\",\"CaseStatus\":\"OPEN\",\"FileOpenDate\":\"10/10/2015 12:00:00 AM\",\"CaseFileNo\":\"JJ/1500000001/\",\"KIV\":\"\",\"TabId\":\"5\",\"Details\":{\"LA\":\"\",\"MANAGER\":\"\",\"InCharge\":\"\",\"CustomerService\":\"\",\"CaseType\":\"SPA-BUY-DEV-APT-C\",\"FileLocation\":\"\",\"FileClosedDate\":\"\",\"VendAcqDt\":\"\",\"CompanyBuisnessSearch\":\"\",\"BankWindingSearch\":\"\"},\"Purchaser\":{\"PurRepresentedByFirm\":\"N\",\"PurlawyerRepresented\":\"N\",\"PurSPADate\":\"1/1/1900 12:00:00 AM\",\"PurEntryOfPrivateCaveat\":\"Chase\",\"PurWithOfPrivateCaveat\":\"Rane\",\"PurFirstName\":\"Name1\",\"PurFirstID\":\"Id1\",\"PurFirstTaxNo\":\"Tax1\",\"PurFirstContactNo\":\"9784561233\",\"PurFirstType\":\"CORPORATE\",\"PurSecName\":\"Name2\",\"PurSecID\":\"Id2\",\"PurSecTaxNo\":\"Tax2\",\"PurSecContactNo\":\"9784561234\",\"PurSecType\":\"INDIVIDUAL\",\"PurThirdName\":\"Name3\",\"PurThirdID\":\"Id3\",\"PurThirdTaxNo\":\"Tax3\",\"PurThirdContactNo\":\"9784561234\",\"PurThirdType\":\"INDIVIDUAL\",\"PurFourthName\":\"Name4\",\"PurFourthID\":\"Id4\",\"PurFourthTaxNo\":\"Tax4\",\"PurFourthContactNo\":\"9784561235\",\"PurFourthType\":\"INDIVIDUAL\"},\"Vendor\":{\"VndrRepresentedByFirm\":\"N\",\"VndrlawyerRepresented\":\"Y\",\"VndrReqDevConsent\":\"Name\",\"VndrReceiveDevConsent\":\"Sam\",\"VndrFirstName\":\"Name1\",\"VndrFirstID\":\"Id1\",\"VndrFirstTaxNo\":\"Tax1\",\"VndrFirstContactNo\":\"9784561233\",\"VndrFirstType\":\"CORPORATE\",\"VndrSecName\":\"Name2\",\"VndrSecID\":\"Id2\",\"VndrSecTaxNo\":\"Tax2\",\"VndrSecContactNo\":\"9784561234\",\"VndrSecType\":\"INDIVIDUAL\",\"VndrThirdName\":\"Name3\",\"VndrThirdID\":\"Id3\",\"VndrThirdTaxNo\":\"Tax3\",\"VndrThirdContactNo\":\"9784561234\",\"VndrThirdType\":\"INDIVIDUAL\",\"VndrFourthName\":\"Name4\",\"VndrFourthID\":\"Id4\",\"VndrFourthTaxNo\":\"Tax4\",\"VndrFourthContactNo\":\"9784561235\",\"VndrFourthType\":\"INDIVIDUAL\"},\"Property\":{\"TitleType\":\"KEKAL\",\"CertifiedPlanNo\":\"\",\"LotNo\":\"\",\"PreviouslyKnownAs\":\"\",\"State\":\"\",\"Area\":\"\",\"BPM\":\"\",\"GovSurvyPlan\":\"\",\"LotArea\":\"12345\",\"Developer\":\"\",\"Project\":\"\",\"DevLicenseNo\":\"\",\"DevSolicitor\":\"\",\"DevSoliLoc\":\"\",\"TitleSearchDate\":\"\",\"DSCTransfer\":\"\",\"DRCTransfer\":\"\",\"FourteenADate\":\"\",\"DRTLRegistry\":\"\",\"PropertyCharged\":\"\",\"BankName\":\"\",\"Branch\":\"\",\"PAName\":\"\",\"PresentationNo\":\"\",\"ExistChargeRef\":\"\",\"ReceiptType\":\"\",\"ReceiptNo\":\"\",\"ReceiptDate\":\"\",\"PurchasePrice\":\"1452\",\"AdjValue\":\"\",\"VndrPrevSPAValue\":\"\",\"Deposit\":\"\",\"BalPurPrice\":\"\",\"LoanAmount\":\"\",\"LoanCaseNo\":\"1234\",\"DiffSum\":\"\",\"RedAmt\":\"\",\"RedDate\":\"\",\"DefRdmptSum\":\"\"},\"LoanPrinciple\":{\""
            + "ReqRedStatement" + "\":" + "\"" + req_for_redemption.getText().toString() + "\",\""
            + "RedStmtDate" + "\":" + "\"" + red_state_date.getText().toString() + "\",\"" + "RedPayDate"
            + "\":" + "\"" + red_payment_date.getText().toString() + "\",\"RepByFirm\":" + "\""
            + rep_firm.isChecked() + "\",\"" + "LoanCaseNo" + "\":" + "\"" + loan_case_no.getText().toString()
            + "\",\"" + "Project" + "\":" + "\"" + project.getText().toString() + "\",\"" + "MasterBankName"
            + "\":" + "\"" + bankValue + "\",\"" + "BranchName" + "\":" + "\""
            + branch_name.getText().toString() + "\",\"" + "Address" + "\":" + "\"" + addr.getText().toString()
            + "\",\"" + "PAName" + "\":" + "\"" + pa_name.getText().toString() + "\",\"" + "BankRef" + "\":"
            + "\"" + bank_ref.getText().toString() + "\",\"" + "BankInsDate" + "\":" + "\""
            + bank_instr_date.getText().toString() + "\",\"" + "LOFDate" + "\":" + "\""
            + letter_offer_date.getText().toString() + "\",\"" + "BankSolicitor" + "\":" + "\""
            + bank_solicitor.getText().toString() + "\",\"" + "SoliLoc" + "\":" + "\""
            + solicitor_loc.getText().toString() + "\",\"" + "SoliRef" + "\":" + "\""
            + solicitor_ref.getText().toString() + "\",\"TypeofLoan\":" + "\"" + TypeofLoan_value + "\",\""
            + "TypeofFacility" + "\":" + "\"" + type_facility.getText().toString() + "\",\"" + "FacilityAmt"
            + "\":" + "\"" + facility_amt.getText().toString() + "\",\"" + "Repaymt" + "\":" + "\""
            + repayment.getText().toString() + "\",\"" + "IntrstRate" + "\":" + "\""
            + interest_rate.getText().toString() + "\",\"" + "MonthlyInstmt" + "\":" + "\""
            + monthly_installment.getText().toString() + "\",\"" + "TermLoanAmt" + "\":" + "\""
            + term_loanamt.getText().toString() + "\",\"" + "Interest" + "\":" + "\""
            + interest.getText().toString() + "\",\"" + "ODLoan" + "\":" + "\"" + od_loan.getText().toString()
            + "\",\"" + "MRTA" + "\":" + "\"" + mrta.getText().toString() + "\",\"" + "BankGuarantee" + "\":"
            + "\"" + bank_guarantee.getText().toString() + "\",\"" + "LetterofCredit" + "\":" + "\""
            + letter_credit.getText().toString() + "\",\"" + "TrustReceipt" + "\":" + "\""
            + trust_receipt.getText().toString() + "\",\"" + "Others" + "\":" + "\""
            + others.getText().toString() + "\",\"LoanDet1\":" + "\"" + LoanDet1.getText().toString()
            + "\",\"LoanDet2\":" + "\"" + LoanDet2.getText().toString() + "\",\"LoanDet3\":" + "\""
            + LoanDet3.getText().toString() + "\",\"LoanDet4\":" + "\"" + LoanDet4.getText().toString()
            + "\",\"LoanDet5\":" + "\"" + LoanDet5.getText().toString()
            + "\"},\"LoanSubsidary\":{\"LoanDocForBankExe\":\"Exe 1\",\"FaciAgreeDate\":\"\",\"LoanDocRetFromBank\":\"\",\"DischargeofCharge\":\"\",\"FirstTypeofFacility\":\"\",\"FirstFacilityAmt\":\"\",\"FirstRepaymt\":\"\",\"FirstIntrstRate\":\"\",\"FirstMonthlyInstmt\":\"1500\",\"FirstTermLoanAmt\":\"\",\"FirstInterest\":\"\",\"FirstODLoan\":\"\",\"FirstMRTA\":\"\",\"FirstBankGuarantee\":\"\",\"FirstLetterofCredit\":\"\",\"FirstTrustReceipt\":\"\",\"FirstOthers\":\"Sample\",\"SecTypeofFacility\":\"\",\"SecFacilityAmt\":\"\",\"SecRepaymt\":\"\",\"SecIntrstRate\":\"12%\",\"SecMonthlyInstmt\":\"\",\"SecTermLoanAmt\":\"\",\"SecInterest\":\"\",\"SecODLoan\":\"\",\"SecMRTA\":\"\",\"SecBankGuarantee\":\"\",\"SecLetterofCredit\":\"\",\"SecTrustReceipt\":\"45A\",\"SecOthers\":\"\",\"ThirdTypeofFacility\":\"Sample_Data\",\"ThirdFacilityAmt\":\"\",\"ThirdRepaymt\":\"\",\"ThirdIntrstRate\":\"\",\"ThirdMonthlyInstmt\":\"\",\"ThirdTermLoanAmt\":\"587.15\",\"ThirdInterest\":\"\",\"ThirdODLoan\":\"\",\"ThirdMRTA\":\"\",\"ThirdBankGuarantee\":\"\",\"ThirdLetterofCredit\":\"\",\"ThirdTrustReceipt\":\"\",\"ThirdOthers\":\"\",\"FourthTypeofFacility\":\"Sample4\",\"FourthFacilityAmt\":\"\",\"FourthRepaymt\":\"15\",\"FourthIntrstRate\":\"\",\"FourthMonthlyInstmt\":\"\",\"FourthTermLoanAmt\":\"\",\"FourthInterest\":\"21\",\"FourthODLoan\":\"\",\"FourthMRTA\":\"\",\"FourthBankGuarantee\":\"\",\"FourthLetterofCredit\":\"\",\"FourthTrustReceipt\":\"\",\"FourthOthers\":\"\",\"FifthTypeofFacility\":\"Sample 5\",\"FifthFacilityAmt\":\"\",\"FifthRepaymt\":\"\",\"FifthIntrstRate\":\"\",\"FifthMonthlyInstmt\":\"\",\"FifthTermLoanAmt\":\"\",\"FifthInterest\":\"10\",\"FifthODLoan\":\"\",\"FifthMRTA\":\"\",\"FifthBankGuarantee\":\"\",\"FifthLetterofCredit\":\"\",\"FifthTrustReceipt\":\"Test\",\"FifthOthers\":\"\"}}]";
    Log.e("pur_string", json_element);

    JSONObject valuesObject = null;/*w w  w.j  a va 2s  . c  o  m*/
    JSONArray list = null;
    try {
        list = new JSONArray(json_element);
        valuesObject = list.getJSONObject(0);

        /*valuesObject.put("PurSPADate",spa_date.getText().toString());
        valuesObject.put("PurEntryOfPrivateCaveat", entry_private_caveat.getText().toString());
        valuesObject.put("PurWithOfPrivateCaveat", withdrawal_private_caveat.getText().toString());
        valuesObject.put("PurFirstName", name1.getText().toString());
        valuesObject.put("PurFirstID", brn_no1.getText().toString());
        valuesObject.put("PurFirstTaxNo", tax_no1.getText().toString());
        valuesObject.put("PurFirstContactNo", contact_no1.getText().toString());*/

        //list.put(valuesObject);

    } catch (JSONException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    RequestParams params = new RequestParams();
    params.put("sJsonInput", list.toString());
    System.out.println("params");

    RestService.post(CONFIRM_BTN_REQUEST, params, new BaseJsonHttpResponseHandler<String>() {

        @Override
        public void onFailure(int arg0, Header[] arg1, Throwable arg2, String arg3, String arg4) {
            // TODO Auto-generated method stub
            System.out.println(arg3);
            System.out.println("onFailure process case purchaser");
        }

        @Override
        public void onSuccess(int arg0, Header[] arg1, String arg2, String arg3) {
            // TODO Auto-generated method stub
            System.out.println("Add purchaser Confirmed");
            System.out.println(arg2);

            // Find status Response
            try {
                StatusResult = jsonResponse.getString("Result").toString();
                messageDisplay = jsonResponse.getString("DisplayMessage").toString();
            } catch (JSONException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            if (StatusResult.equals("SUCCESS")) {
                Intent iAddBack = new Intent(ProcessCaseLoanPrincipal.this, ProcesscaseLoanSubsidiary.class);
                startActivity(iAddBack);
                Toast.makeText(ProcessCaseLoanPrincipal.this, messageDisplay, Toast.LENGTH_SHORT).show();
            } else {
                Toast.makeText(ProcessCaseLoanPrincipal.this, messageDisplay, Toast.LENGTH_SHORT).show();

            }
        }

        @Override
        protected String parseResponse(String arg0, boolean arg1) throws Throwable {

            // Get Json response
            arrayResponse = new JSONArray(arg0);
            jsonResponse = arrayResponse.getJSONObject(0);

            System.out.println("Purchaser Add Response");
            System.out.println(arg0);
            return null;
        }
    });
}

From source file:com.footprint.cordova.plugin.localnotification.LocalNotification.java

/**
 * Persist the information of this alarm to the Android Shared Preferences.
 * This will allow the application to restore the alarm upon device reboot.
 * Also this is used by the cancelAll method.
 *
 * @param alarmId//from  ww w  .j  a  va2s.  co m
 *            The Id of the notification that must be persisted.
 * @param args
 *            The assumption is that parse has been called already.
 */
public static void persist(String alarmId, JSONArray args) {
    Editor editor = getSharedPreferences().edit();

    if (alarmId != null) {
        editor.putString(alarmId, args.toString());
        editor.apply();
    }
}

From source file:vOS.controller.socket.IOConnection.java

/**
 * Creates a new {@link IOAcknowledge} instance which sends its arguments
 * back to the server.//www.  j a v a2 s .c o  m
 * 
 * @param message
 *            the message
 * @return an {@link IOAcknowledge} instance, may be <code>null</code> if
 *         server doesn't request one.
 */
private IOAcknowledge remoteAcknowledge(IOMessage message) {
    String _id = message.getId();
    if (_id.equals(""))
        return null;
    else if (_id.endsWith("+") == false)
        _id = _id + "+";
    final String id = _id;
    final String endPoint = message.getEndpoint();
    return new IOAcknowledge() {
        @Override
        public void ack(Object... args) {
            JSONArray array = new JSONArray();
            for (Object o : args) {
                try {
                    array.put(o == null ? JSONObject.NULL : o);
                } catch (Exception e) {
                    error(new SocketIOException(
                            "You can only put values in IOAcknowledge.ack() which can be handled by JSONArray.put()",
                            e));
                }
            }
            IOMessage ackMsg = new IOMessage(IOMessage.TYPE_ACK, endPoint, id + array.toString());
            sendPlain(ackMsg.toString());
        }
    };
}

From source file:com.pimp.companionforband.fragments.cloud.SummariesFragment.java

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    summariesLV = (ListView) view.findViewById(R.id.summaries_listview);
    statusTV = (TextView) view.findViewById(R.id.status_textview);
    stringArrayList = new ArrayList<>();
    stringArrayAdapter = new ArrayAdapter<>(getContext(), R.layout.activities_list_item,
            R.id.list_item_textView, stringArrayList);
    summariesLV.setAdapter(stringArrayAdapter);

    RequestQueue queue = Volley.newRequestQueue(getContext());

    JsonObjectRequest profileRequest = new JsonObjectRequest(Request.Method.GET,
            CloudConstants.BASE_URL + CloudConstants.Summaries_URL
                    + "Daily?startTime=2015-01-01T16%3A04%3A49.8578590-07%3A00",
            null, new Response.Listener<JSONObject>() {
                @Override/*  ww w  .j  a v  a 2  s  .co  m*/
                public void onResponse(JSONObject response) {
                    statusTV.setText("CSV file can be found in CompanionForBand/Summaries\n");

                    Iterator<String> stringIterator = response.keys();
                    while (stringIterator.hasNext()) {
                        try {
                            String key = stringIterator.next();
                            JSONArray jsonArray = response.getJSONArray(key);

                            String path = Environment.getExternalStorageDirectory().getAbsolutePath()
                                    + File.separator + "CompanionForBand" + File.separator + "Summaries";
                            File file = new File(path);
                            file.mkdirs();

                            JsonFlattener parser = new JsonFlattener();
                            CSVWriter writer = new CSVWriter();
                            try {
                                List<LinkedHashMap<String, String>> flatJson = parser
                                        .parseJson(jsonArray.toString());
                                writer.writeAsCSV(flatJson, path + File.separator + key + ".csv");
                            } catch (Exception e) {
                                Log.e("SummariesParseJson", e.toString());
                            }

                            for (int i = 0; i < jsonArray.length(); i++) {
                                JSONObject activity = jsonArray.getJSONObject(i);
                                Iterator<String> iterator = activity.keys();
                                String str = "";
                                while (iterator.hasNext()) {
                                    key = iterator.next();
                                    str = str + UIUtils.splitCamelCase(key) + " : "
                                            + activity.get(key).toString() + "\n";
                                }
                                stringArrayAdapter.add(str);
                            }
                        } catch (Exception e) {
                            Log.e("Summaries", e.toString());
                        }
                    }
                }
            }, new Response.ErrorListener() {
                @Override
                public void onErrorResponse(VolleyError error) {
                    Toast.makeText(getActivity(), error.toString(), Toast.LENGTH_LONG).show();
                }
            }) {
        @Override
        public Map<String, String> getHeaders() throws AuthFailureError {
            HashMap<String, String> headers = new HashMap<>();
            headers.put("Authorization",
                    "Bearer " + MainActivity.sharedPreferences.getString("access_token", "hi"));

            return headers;
        }
    };

    queue.add(profileRequest);
}

From source file:com.openerp.addons.note.AddFollowerFragment.java

public Boolean getPartnersFromServer() {

    boolean loaded = true;
    if (!flag) {/*from   w w w.  j  ava2s.c om*/
        res_partners = new Res_PartnerDBHelper(scope.context());
        oe = res_partners.getOEInstance();
        try {
            ArrayList<Fields> cols = res_partners.getServerColumns();
            JSONObject fields = new JSONObject();
            for (Fields field : cols) {
                fields.accumulate("fields", field.getName());
            }
            JSONObject domain = new JSONObject();
            JSONArray ids = JSONDataHelper.intArrayToJSONArray(oe.getAllIds(res_partners));

            domain.accumulate("domain", new JSONArray("[[\"id\", \"not in\", " + ids.toString() + "]]"));

            JSONObject result = oe.search_read("res.partner", fields, domain, 0, 0, null, null);

            for (int i = 0; i < result.getInt("length"); i++) {
                JSONObject row = result.getJSONArray("records").getJSONObject(i);
                HashMap<String, Object> rowHash = new HashMap<String, Object>();
                @SuppressWarnings("unchecked")
                Iterator<String> keys = row.keys();

                while (keys.hasNext()) {
                    String key = keys.next();
                    rowHash.put(key, row.get(key));
                }
                final OEListViewRows listRow = new OEListViewRows(row.getInt("id"), rowHash);

                scope.context().runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        listRows.add(listRow);
                        listAdapters.refresh(listRows);
                    }
                });
                flag = true;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    } else {
        loaded = false;
    }
    return loaded;
}

From source file:com.openerp.addons.note.AddFollowerFragment.java

public void addFollowers(int partnerId) {

    res_partners = new Res_PartnerDBHelper(scope.context());
    oe = res_partners.getOEInstance();/*from   w  w w .ja v a 2  s  .c o  m*/
    try {
        JSONObject args = new JSONObject();
        args.put("res_model", "note.note");
        args.put("res_id", record_id);
        args.put("message", message);
        JSONArray partner_ids = new JSONArray();
        partner_ids.put(6);
        partner_ids.put(false);
        JSONArray c_ids = new JSONArray();
        c_ids.put(partnerId);
        partner_ids.put(c_ids);
        args.put("partner_ids", new JSONArray("[" + partner_ids.toString() + "]"));
        JSONObject result = oe.createNew("mail.wizard.invite", args);
        int id = result.getInt("result");

        // calling mail.wizard.invite method
        JSONArray arguments = new JSONArray();
        JSONArray result_id = new JSONArray();
        result_id.put(id);
        arguments.put(result_id);

        JSONObject newValues = new JSONObject();
        newValues.put("default_res_model", "note.note");
        newValues.put("default_res_id", args.getInt("res_id"));
        JSONObject newContext = oe.updateContext(newValues);
        arguments.put(newContext);
        oe.call_kw("mail.wizard.invite", "add_followers", arguments);

    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:de.kp.ames.web.function.domain.model.JsonReasoner.java

public void set(RegistryObjectImpl ro, Locale locale) throws JSONException, JAXRException {

    /*/*w  w  w. ja  v a2s  .  c om*/
     * Convert registry object
     */
    super.set(ro, locale);

    /*
     * Convert reasoner specific information
     */
    ServiceImpl reasoner = (ServiceImpl) ro;

    /*
     * Convert specifications
     */
    JSONArray jArray = getSpecifications(reasoner);
    put(JaxrConstants.RIM_SPEC, jArray.toString());

    /*
     * Convert icon
     */
    put(JaxrConstants.RIM_ICON, IconConstants.SERVICE);

}

From source file:net.anymeta.Test.java

/**
 * @param args//from   www.j a  va2  s  .c om
 */
public static void main(String[] arg) throws AnyMetaRegistryException, AnyMetaException, JSONException {
    HashMap<String, Object> args;

    // Load the API
    AnyMetaAPI api = AnyMetaAPI.fromRegistry("pluto.local");

    // Get information for the currently logged in user.
    JSONObject o = (JSONObject) api.doMethod("anymeta.user.info");
    System.out.println("Logged in as " + o.getString("title"));

    //  
    args = new HashMap<String, Object>();
    args.put("q_kind", "PERSON");

    JSONArray a = (JSONArray) api.doMethod("query.execute", args);
    System.out.println(a.toString());
    System.out.println(a.length());

    // Lookup an RFID tag.
    args = new HashMap<String, Object>();
    ArrayList<String> ids = new ArrayList<String>();
    ids.add("65");
    ids.add("94");
    args.put("ids", ids);
    args.put("predicate", "KNOWS");

    o = (JSONObject) api.doMethod("contact.link", args);
    System.out.println(o.toString());

    // Upload an image
    args = new HashMap<String, Object>();
    args.put("mime", "image/jpeg");
    args.put("data", "@C:\\bla.jpg");

    o = (JSONObject) api.doMethod("anymeta.attachment.create", args);
    System.out.println(o.toString());

}