复杂字符串到String []数组

时间:2016-06-01 15:01:21

标签: java arrays json string parsing

这些时候做一些Java。我有一个像这样的字符串:

String output = [{"id":1,"enterpriseId":1,"firstName":"Arnaud","lastName":"Arnaud","sessionId":"2_MX4"},
                 {"id":3,"enterpriseId":5,"firstName":"Benjamin","lastName":"Benjamin","sessionId":"1_MX40"},
                 {"id":4,"enterpriseId":1,"firstName":"Nicolas","lastName":"Nicolas","sessionId":"1_MX40N"},
                 {"id":5,"enterpriseId":1,"firstName":"Eliott","lastName":"Eliott","sessionId":"1_MX40NT"}]

如您所见,它包含som JSON格式化文本。我想要的是将这个String转换为String的数组,以便将数组的每一行解析为JSONObject。 尝试了一些基本的东西:

String[] strArray = new String[] {output};

但这不起作用.. 有任何想法吗 ?谢谢!

0 个答案:

没有答案