maven坐标
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>RELEASE</version>
</dependency>
JSONObject — > String
public class main {
public static void main(String[] args) {
long []array = new long[]{123456};
JSONObject jsonBody = new JSONObject();
jsonBody.put("cameraIndexCode", array);
jsonBody.put("streamType", 0);
jsonBody.put("protocol", "rtsp");
jsonBody.put("transmode", 1);
jsonBody.put("expand", "streamform=ps");
String body = jsonBody.toJSONString();
System.out.println(body);
}
}