著作権:Copyright権利を保有https://blog.csdn.net/weixin_39921821/article/details/90520781
1.キーに対応するJSONの単純な文字列値を取得
パッケージJSON-libの-2.4.jarをインポートするために提供されます
コードは以下の通りであります:
import net.sf.json.JSONObject;
public class Test {
public static void main(String[] args) {
String jsonStr="{\"trans\":\"01\",\"fileId\":\"中心编号\",\"context\":\"文件流的base64字符串\"}";
JSONObject json = JSONObject.fromObject(jsonStr);
String trans=json.getString("trans");
String fileId=json.getString("fileId");
String context=json.getString("context");
System.out.println("["+trans+"]["+fileId+"]["+context+"]");
}
}
レンダリング: