Android,收到JSON条短信

Android, get JSON SMS

我通过 SMS 发送此 jSON:

{"l":"-3","i":"1062","od":[{"l":"-3","i":"2448"},{"l":"-4","i":"2449"}]}

但是我通过 shortMessage.getMessageBody()shortMessage.getDisplayMessageBody() 得到了这个字符串:

"l":"-3","i":"1062","od": "l":"-3","i":"2448" , "l":"-4","i":"2449"

为什么 JSON 格式损坏以及如何获得正确的格式?

尝试这样发送...

"{""l":"-3","i":"1062","od":"[{""l":"-3", "i":"2448""}","{""l":"-4","i":"2449""}]}"

终于找到问题了! 问题出在设备上(在本例中:Samsung galaxy note 10.1) 并且解决方案是使用特殊字符而不是这四个字符:{} [] 所以我在发送短信之前替换了字符,然后在设备上再次替换它们。我使用了这些字符:

! = { @ = } # = [ % = ]