我在Jython中有一个字符串,它表示JSON数组的列表:
[{"datetime": 1570216445000, "type": "test"},{"datetime": 1570216455000, "type": "test2"}]
但是,如果我尝试对此进行迭代,它将仅对每个字符进行迭代。如何使它遍历实际列表,以便可以取出每个JSON数组?
背景信息-该脚本正在Apache NiFi中运行,下面是字符串源自的代码:
from org.apache.commons.io import IOUtils
...
def process(self, inputStream):
text = IOUtils.toString(inputStream,StandardCharsets.UTF_8)
您可以解析JSON
,类似于在Python
中的操作。