Sub AStream_NewData (Buffer() As Byte)
Dim MyStr As String
MyStr = BytesToString(Buffer,0,Buffer.Length,"UTF-8")
MyStr = MyStr.Trim
'
' Log(MyStr)
Dim strJSON As String
Dim pos1 As Int
Dim pos2 As Int
pos1 = MyStr.IndexOf("{")
pos2 = MyStr.LastIndexOf("}")
strJSON=MyStr.SubString2(pos1,(pos2 + 1))
Log(pos1)
Log(pos2)
Log(strJSON)
Dim parser As JSONParser
parser.Initialize(MyStr)
Dim root As Map = parser.NextObject
Dim data As String = root.Get("data")
Dim device As String = root.Get("device")
Log(data)
Log(device)
' Close Connection
Disconnect
End Sub