recherche

Maison  >  Questions et réponses  >  le corps du texte

java - jsonObject.has()是干嘛的?

jsonObject.has()是干嘛的?

  String jsonStr=new String(data);
        try {
            JSONObject jsonObject=new JSONObject(jsonStr);

            if (jsonObject.has("fileUri")){
            }


        } catch (JSONException e) {
            e.printStackTrace();
        }
高洛峰高洛峰2888 Il y a quelques jours581

répondre à tous(4)je répondrai

  • 怪我咯

    怪我咯2017-04-18 09:19:18

    Determine if the JSONObject contains a specific key.
    Parameters:
    key A key string.
    Returns:
    true if the key exists in the JSONObject.
    
        public boolean has(String key) {
             return this.map.containsKey(key);
        }
        
        public JSONObject() {
            this.map = new HashMap<String, Object>();
        }
    

    On peut voir que le jugement est effectué en utilisant la méthode Map.containsKey(key).

    répondre
    0
  • PHP中文网

    PHP中文网2017-04-18 09:19:18

    répondre
    0
  • 巴扎黑

    巴扎黑2017-04-18 09:19:18

    Déterminer s'il y a un certain champ dans la classe

    répondre
    0
  • 怪我咯

    怪我咯2017-04-18 09:19:18

    Requête si l'objet contient la clé et renvoie un booléen, ce qui est cohérent avec l'utilisation de Map.containsKey(key)

    répondre
    0
  • Annulerrépondre