当前位置:网站首页 > Vue.js开发 > 正文

map转换为json字符串(map转换为jsonobject)

package test;

import org.json.JSONArray;

import org.json.JSONException;

import org.json.JSONObject;

import org.json.XML;

public class Test {

public static String signData = " orderId 5001 payAccountNo kevin 4775 amount undefined 520 masterName undefined sn payDate undefined ";

public static void main(String[] args) {

/*JSONObject jsonObj = null;

try {

jsonObj = XML.toJSONObject(signData);

JSONObject jsonBodSignData = jsonObj.getJSONObject("BodSignData");

System.err.println(jsonBodSignData.toString());

JSONArray jsonField=jsonBodSignData.getJSONArray("Field");

System.err.println(jsonField);

for (int i = 0; i < jsonField.length(); i++) {

System.err.println(jsonField.get(i));

}

} catch (JSONException e) {

e.printStackTrace();

}

Log.e("XML", signData);

Log.e("JSON", jsonObj.toString());

//System.err.println(signData);

//System.err.println(jsonObj.toString());

*/

String resp=" 0 ";

try {

JSONObject jsonObj = XML.toJSONObject(resp);

JSONObject jsonRequest = jsonObj.getJSONObject("request");

JSONObject jsonfilelist=jsonRequest.getJSONObject("filelist");

JSONObject jsontreenode=jsonfilelist.getJSONObject("treenode");

int jsoncode=jsontreenode.getInt("code");

System.err.println(jsoncode);

} catch (JSONException e) {

e.printStackTrace();

}

}

到此这篇map转换为json字符串(map转换为jsonobject)的文章就介绍到这了,更多相关内容请继续浏览下面的相关推荐文章,希望大家都能在编程的领域有一番成就!

版权声明


相关文章:

  • Json字符串转数组(json字符串转jsonarray)2026-05-19 19:45:04
  • map转json字符串再转回map(map变成json字符串)2026-05-19 19:45:04
  • 卡巴斯基7.0破解版(卡巴斯基中文手机破解版)2026-05-19 19:45:04
  • vue安装不上(vue安装不上怎么办)2026-05-19 19:45:04
  • 卡巴斯基更新源(卡巴斯基7.0)2026-05-19 19:45:04
  • pcie5.0能插pcie4.0么(pcie5.0有什么用)2026-05-19 19:45:04
  • js 深拷贝方法(js实现深拷贝函数)2026-05-19 19:45:04
  • 电脑扬声器安装程序(电脑扬声器安装程序怎么安装5.1声道)2026-05-19 19:45:04
  • 跨域解决方案js(nginx跨域解决方案)2026-05-19 19:45:04
  • vue插槽怎么传值(vue插槽传参)2026-05-19 19:45:04
  • 全屏图片