问题描述
- 数据解析String count;count就是下面的数据。希望各位能帮个忙
-
addPolizeisacheList{
polizeisacheList{
bicycleOwner{
id: 53bicycleOwnerName: "34527424034427021153"gender: 0iDCardNumber: "320211199408090712"phone: "15312362612"address: "344270212346265267346265246344270234"username: "owner53"domicile: "346261237350213217350213217345267236"createTime: 1454320052799
}bicycle{
id: 117bicycleOwnerID: 53model: "45"color: "415"number: "45"vehicleIdentifyNumber: "56"motorNumber: "45"price: "45"shoppingPoint: "45"shoppingTime: "2016-01-28"licenseUrl: "/picture/bicycle/2016/04/6b13d4b8-4aaa-4137-8e03-0b2d27713b6d.png"brandUrl: "/picture/bicycle/2016/04/e148a7f4-4d80-42a3-8a17-0cf0be29396c.png"frontUrl: "/picture/bicycle/2016/04/5de4e9dd-e523-4706-a9df-4a8042356bae.png"backUrl: "/picture/bicycle/2016/04/3cdb7ac7-8816-4ff7-b6de-6ea972ad5c32.png"IdentityCardForwardUrl: "/picture/bicycle/2016/04/01427ca8-cda7-49d3-bf9e-8707086bc26b.png"IdentityCardBackUrl: "/picture/bicycle/2016/04/41e69903-e583-4724-a232-187ac50ea77d.png"batteryNumber: "45"rfid: 19616434createTime: 1460183312000policeStationID: 11theftStatus: 1
}happeningTime: 1461639765000reporter: "34527424034427021153"phone: "53"happeningPlace: "w"description: "w"policemans{
id: 195name: "345274240351224246351272237"number: "002"
}policemans{
id: 195name: "345274240351224246351272237"number: "002"
}policemans{
id: 196name: "347224260347247213347237263"number: "ht003"
}policeStations{
id: 11policeStationName: "346250252346262224346211200"
}policeStations{
id: 51policeStationName: "java345274200345217221347273204"
}handleTime: 1460183312000handleTime: 1461639767000handleTime: 1461654339318status: 1trackList{}
}
}lastPushTime: 1462351346resutl: true
解决方案
这就是标准的json格式,用你用的语言+json解析作为关键字,google下就有。
解决方案二:
05-05 10:53:38.834: W/System.err(10449): org.json.JSONException: Value lastPushTime of type java.lang.String cannot be converted to JSONObject
05-05 10:53:38.835: W/System.err(10449): at org.json.JSON.typeMismatch(JSON.java:111)
05-05 10:53:38.836: W/System.err(10449): at org.json.JSONObject.(JSONObject.java:158)
05-05 10:53:38.837: W/System.err(10449): at org.json.JSONObject.(JSONObject.java:171)
05-05 10:53:38.838: W/System.err(10449): at cn.bearhunting.push.service.NettyService.onData(NettyService.java:110)
05-05 10:53:38.839: W/System.err(10449): at cn.bearhunting.push.netty.handler.MessageHandler.channelRead0(MessageHandler.java:50)
05-05 10:53:38.839: W/System.err(10449): at cn.bearhunting.push.netty.handler.MessageHandler.channelRead0(MessageHandler.java:1)
05-05 10:53:38.840: W/System.err(10449): at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
05-05 10:53:38.841: W/System.err(10449): at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308)
05-05 10:53:38.842: W/System.err(10449): at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:294)
05-05 10:53:38.842: W/System.err(10449): at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:265)
05-05 10:53:38.843: W/System.err(10449): at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308)
05-05 10:53:38.844: W/System.err(10449): at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:294)
05-05 10:53:38.845: W/System.err(10449): at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:266)
05-05 10:53:38.846: W/System.err(10449): at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308)
05-05 10:53:38.847: W/System.err(10449): at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:294)
05-05 10:53:38.847: W/System.err(10449): at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1110)
05-05 10:53:38.848: W/System.err(10449): at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:968)
05-05 10:53:38.849: W/System.err(10449): at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:349)
05-05 10:53:38.850: W/System.err(10449): at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:244)
05-05 10:53:38.851: W/System.err(10449): at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308)
05-05 10:53:38.852: W/System.err(10449): at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:294)
05-05 10:53:38.853: W/System.err(10449): at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:846)
05-05 10:53:38.854: W/System.err(10449): at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131)
05-05 10:53:38.855: W/System.err(10449): at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511)
05-05 10:53:38.856: W/System.err(10449): at io.netty.channel.nio.NioEventLoop.processSelectedKeysPlain(NioEventLoop.java:430)
05-05 10:53:38.857: W/System.err(10449): at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:384)
05-05 10:53:38.858: W/System.err(10449): at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354)
05-05 10:53:38.858: W/System.err(10449): at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112)
05-05 10:53:38.859: W/System.err(10449): at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137)
05-05 10:53:38.860: W/System.err(10449): at java.lang.Thread.run(Thread.java:838)
我把count转jsons时候出这个错了
解决方案三:
05-05 10:53:38.834: W/System.err(10449): org.json.JSONException: Value lastPushTime of type java.lang.String cannot be converted to JSONObject
05-05 10:53:38.835: W/System.err(10449): at org.json.JSON.typeMismatch(JSON.java:111)
05-05 10:53:38.836: W/System.err(10449): at org.json.JSONObject.(JSONObject.java:158)
05-05 10:53:38.837: W/System.err(10449): at org.json.JSONObject.(JSONObject.java:171)
05-05 10:53:38.838: W/System.err(10449): at cn.bearhunting.push.service.NettyService.onData(NettyService.java:110)
05-05 10:53:38.839: W/System.err(10449): at cn.bearhunting.push.netty.handler.MessageHandler.channelRead0(MessageHandler.java:50)
05-05 10:53:38.839: W/System.err(10449): at cn.bearhunting.push.netty.handler.MessageHandler.channelRead0(MessageHandler.java:1)
05-05 10:53:38.840: W/System.err(10449): at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
05-05 10:53:38.841: W/System.err(10449): at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308)
05-05 10:53:38.842: W/System.err(10449): at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:294)
05-05 10:53:38.842: W/System.err(10449): at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:265)
05-05 10:53:38.843: W/System.err(10449): at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308)
05-05 10:53:38.844: W/System.err(10449): at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:294)
05-05 10:53:38.845: W/System.err(10449): at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:266)
05-05 10:53:38.846: W/System.err(10449): at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308)
05-05 10:53:38.847: W/System.err(10449): at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:294)
05-05 10:53:38.847: W/System.err(10449): at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1110)
05-05 10:53:38.848: W/System.err(10449): at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:968)
05-05 10:53:38.849: W/System.err(10449): at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:349)
05-05 10:53:38.850: W/System.err(10449): at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:244)
05-05 10:53:38.851: W/System.err(10449): at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308)
05-05 10:53:38.852: W/System.err(10449): at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:294)
05-05 10:53:38.853: W/System.err(10449): at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:846)
05-05 10:53:38.854: W/System.err(10449): at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131)
05-05 10:53:38.855: W/System.err(10449): at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511)
05-05 10:53:38.856: W/System.err(10449): at io.netty.channel.nio.NioEventLoop.processSelectedKeysPlain(NioEventLoop.java:430)
05-05 10:53:38.857: W/System.err(10449): at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:384)
05-05 10:53:38.858: W/System.err(10449): at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354)
05-05 10:53:38.858: W/System.err(10449): at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112)
05-05 10:53:38.859: W/System.err(10449): at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137)
05-05 10:53:38.860: W/System.err(10449): at java.lang.Thread.run(Thread.java:838)