前期编写xml解析器,需要把挑出来的个别数据调用web service接口传到mes系统。
功能那时已经实现,只是数据格式一直是不伦不类的状态。这次把数据格式搞定了。
model:
调用:
数据从list中取出放入数组:
数组元素逐个转换JObject对象:
最后整合成JArray对象:
最后的数据:
[
"{"DateTime":"2018-10-08 08:44:32","SampleNumber":"S18080629","UserValue1":"10839","TestMethod":"DS1000KG","TestForce":"2246.00","Max":"","ValidForce":"1000g"}",
"{"DateTime":"2018-10-08 08:44:32","SampleNumber":"S18080629","UserValue1":"10839","TestMethod":"DS1000KG","TestForce":"2014.00","Max":"","ValidForce":"1000g"}",
"{"DateTime":"2018-10-08 08:44:32","SampleNumber":"S18080629","UserValue1":"10839","TestMethod":"DS1000KG","TestForce":"1634.00","Max":"","ValidForce":"1000g"}"
]
这次算是把之前想用但是一直不知道怎么下手的JSon用上了,但是还是一个小白。