Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/369.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将java字符串转换为json对象_Java_Json - Fatal编程技术网

将java字符串转换为json对象

将java字符串转换为json对象,java,json,Java,Json,我有一个这种格式的java字符串 "{name:MyName, rage:200, height:100}" 我需要将其转换为JsonObject,格式如下 {name:MyName, rage:200, height:100} // that is i want to remove the start and end double quotes fro the above string . 有人能帮我吗。使用json.org库。它就像新的JSONObject一样简单其中s是字符串使用j

我有一个这种格式的java字符串

"{name:MyName, rage:200, height:100}"
我需要将其转换为JsonObject,格式如下

 {name:MyName, rage:200, height:100} // that is i want to remove the  start and end double quotes fro the above string .

有人能帮我吗。

使用json.org库。它就像
新的JSONObject一样简单
其中s是
字符串

使用json.org库。它就像
新的JSONObject一样简单
其中s是一个
字符串

您尝试过Jackson JSON库吗

您尝试过Jackson JSON库吗

如果您只想删除引号,那么应该使用

final String input = "\"{name:MyName, rage:200, height:100}\"";
final String result = StringUtils.mid (input, 1, input.length () - 2);
// result should not contain the beginning and ending quotes

如果您只是想删除引号,那么应该使用

final String input = "\"{name:MyName, rage:200, height:100}\"";
final String result = StringUtils.mid (input, 1, input.length () - 2);
// result should not contain the beginning and ending quotes