Json array (beginning in brackets []) string to json objects

In [] array JSON beginning of the string: 
str = "[{ 
    " name ":" San " , "
     age ":" 28 " 
}] "
 
// wherein str string format 

the JSONArray JSONArray = JSONArray.fromObject (str ); 

// if {} is the beginning of the string 

    str = "{ 
    " name ":" San " , "
     age ":" 28 " 
} "
 
// wherein str string format 

the jSONObject jsonObject = JSONObject.fromObject ( str);

Which it should be noted in a string garbled when a Chinese can not be converted.

Guess you like

Origin www.cnblogs.com/yydxh/p/11958847.html