2016-03-05 64 views
0

你能幫我理解如何使用jsonparse函數解析這個在b4a中的數據。請我需要你的幫助如此糟糕。b4a如何解析json數據

[{"success":true,"msg":"Your transaction has been successfully Completed. Thank you for having us. Please enjoy our service.","data":[{"fn":"sdf","mn":"sdf","ln":"sdf","contactNum":"324","email":"[email protected]","regcode":"201635df42e","regDateTime":"2016-3-5 13:43:26","cus_status":"active","tag":"0ec2c07d19095396d49a41796609a6ae"},{"fn":"sdf","mn":"sdf","ln":"sdf","contactNum":"234","email":"[email protected]","regcode":"201635d89f1","regDateTime":"2016-3-5 13:43:26","cus_status":"active","tag":"0ec2c07d19095396d49a41796609a6ae"}]}] 

簡潔的外觀:

[ 
{ 
    "success":true, 
    "msg":"Your transaction has been successfully Completed. Thank you for having us. Please enjoy our service.", 


    "data":[ 
     { 
      "fn":"sdf", 
      "mn":"sdf", 
      "ln":"sdf", 
      "contactNum":"324", 
      "email":"[email protected]", 
      "regcode":"201635df42e", 
      "regDateTime":"2016-3-5 13:43:26", 
      "cus_status":"active", 
      "tag":"0ec2c07d19095396d49a41796609a6ae" 
     }, 
     { 
      "fn":"sdf", 
      "mn":"sdf", 
      "ln":"sdf", 
      "contactNum":"234", 
      "email":"[email protected]", 
      "regcode":"201635d89f1", 
      "regDateTime":"2016-3-5 13:43:26", 
      "cus_status":"active", 
      "tag":"0ec2c07d19095396d49a41796609a6ae" 
     } 
    ] 
} 

]

您的幫助將是非常讚賞。

+0

[如何解析JSON在安卓(HTTP的可能重複://計算器。 COM /問題/ 9605913 /如何對解析JSON的功能於機器人) –

回答

1

這應該爲你工作:

Dim parser As JSONParser 
parser.Initialize(<text>) 
Dim root As Map = parser.NextObject 
Dim msg As String = root.Get("msg") 
Dim data As List = root.Get("data") 
For Each coldata As Map In data 
Dim contactNum As String = coldata.Get("contactNum") 
Dim regDateTime As String = coldata.Get("regDateTime") 
Dim mn As String = coldata.Get("mn") 
Dim ln As String = coldata.Get("ln") 
Dim cus_status As String = coldata.Get("cus_status") 
Dim fn As String = coldata.Get("fn") 
Dim regcode As String = coldata.Get("regcode") 
Dim tag As String = coldata.Get("tag") 
Dim email As String = coldata.Get("email") 
Next 
Dim success As String = root.Get("success") 

與本網站爲您的JSON數據生成代碼: http://www.basic4ppc.com:51042/json/index.html