JSON

Android»ùÕ¾¶¨Î»(5)

×ÖºÅ+ ×÷ÕߣºH5Ö®¼Ò À´Ô´£ºH5Ö®¼Ò 2017-07-31 11:01 ÎÒÒªÆÀÂÛ( )

/** * »ñÈ¡JSONÐÎʽµÄ»ùÕ¾ÐÅÏ¢ * @param mcc Òƶ¯¹ú¼Ò´úÂ루ÖйúµÄΪ460£© * @param mnc Òƶ¯ÍøÂçºÅÂ루ÖйúÒƶ¯Îª0£¬ÖйúÁªÍ¨Îª1£¬ÖйúµçÐÅΪ2£©£» * @param lac λÖÃÇøÓòÂë * @param cid »ùÕ¾±àºÅ * @param bsss

/**
* »ñÈ¡JSONÐÎʽµÄ»ùÕ¾ÐÅÏ¢
* @param mcc Òƶ¯¹ú¼Ò´úÂ루ÖйúµÄΪ460£©
* @param mnc Òƶ¯ÍøÂçºÅÂ루ÖйúÒƶ¯Îª0£¬ÖйúÁªÍ¨Îª1£¬ÖйúµçÐÅΪ2£©£»
* @param lac λÖÃÇøÓòÂë
* @param cid »ùÕ¾±àºÅ
* @param bsss »ùÕ¾ÐźÅÇ¿¶È
* @return json
* @throws JSONException
*/
private String getJsonCellPos(int mcc, int mnc, int lac, int cid, int bsss) throws JSONException {
JSONObject jsonCellPos = new JSONObject();
jsonCellPos.put("version", "1.1.0");
jsonCellPos.put("host", "maps.google.com");
JSONArray array = new JSONArray();
JSONObject json1 = new JSONObject();
json1.put("location_area_code", "" + lac + "");
json1.put("mobile_country_code", "" + mcc + "");
json1.put("mobile_network_code", "" + mnc + "");
json1.put("age", 0);
json1.put("cell_id", "" + cid + "");
json1.put("signal_strength", bsss);
array.put(json1);
jsonCellPos.put("cell_towers", array);
return jsonCellPos.toString();
}

ÇëÇóµÄJSON×Ö·û´®£º

{
"cell_towers":
[
{
"mobile_network_code":"0",
"location_area_code":"6338",
"cell_id":"62291",
"signal_strength":-95,
"age":0,
"mobile_country_code":"460"
}
],
"host":"maps.google.com",
"version":"1.1.0"
}

·µ»ØJSONÐÎʽ½á¹û£º

{
            "location":
            {
           &nbsp ;    "latitude":"31.214667405",
                 "longitude":"121.59903152499999",
           &nbs p;    "address":
                 {
           &nbsp ;        "city":" ÉϺ£ÊÐÆÖ¶«ÐÂÇø¹ùÊؾ´Â·;ÉϺ£°ÂÍþ¿Æ¼¼¿ª·¢¹«Ë¾¡¢ ¿ÆÍþ¹ú¼Ê¼¼ÊõתÒÆÖÐÐĹ«Ë¾¡¢ÕŽ­¸ß¿Æ¼¼Ô°ÇøÈÈÁ¦ÖÐÐÄ[¸½½ü]",
                     "country":"",
                     "country_code":"",
            &nbsp ;       "county":"",
            &nbsp ;       "postal_code":"",
                     "region":"",
                     "street":"",
                     "street_number":""
                 }
           },
           "access_token":"dummytoken"
        }

2¡¢Í¨¹ý¶à¸ö¸½½üµÄ»ùÕ¾ÐÅÏ¢¶¨Î»£º

ÓÖÒ»´Î²ÂÏ룺

ÇëÇóJSON£º

¡¡

1.±¾Õ¾×ñÑ­ÐÐÒµ¹æ·¶£¬ÈκÎתÔصĸå¼þ¶¼»áÃ÷È·±ê×¢×÷ÕߺÍÀ´Ô´£»2.±¾Õ¾µÄÔ­´´ÎÄÕ£¬ÇëתÔØʱÎñ±Ø×¢Ã÷ÎÄÕÂ×÷ÕߺÍÀ´Ô´£¬²»×ðÖØÔ­´´µÄÐÐΪÎÒÃǽ«×·¾¿ÔðÈΣ»3.×÷ÕßͶ¸å¿ÉÄܻᾭÎÒÃDZ༭Ð޸Ļò²¹³ä¡£

Ïà¹ØÎÄÕÂ
  • AndroidʵսÖÐÓëJsonÊý¾Ý¡¢Java

    AndroidʵսÖÐÓëJsonÊý¾Ý¡¢Java

    2017-07-29 14:03

  • AndroidµÄGradle¼¼ÇÉ 4.3ÅųýÈÎÎñ

    AndroidµÄGradle¼¼ÇÉ 4.3ÅųýÈÎÎñ

    2017-07-06 08:02

  • ubuntuÒÆÖ²jsoncppµ½Androidƽ̨

    ubuntuÒÆÖ²jsoncppµ½Androidƽ̨

    2017-07-04 18:00

  • Android ½âÎöJSONÊý¾Ý¸ñʽ

    Android ½âÎöJSONÊý¾Ý¸ñʽ

    2017-06-26 18:04

ÍøÓѵãÆÀ
£