parse a json
i have used the following code,
Dim exampleJson As String = TextBox2.Text
Dim tempPost = New With {Key .balance = ""}
Dim post = JsonConvert.DeserializeAnonymousType(exampleJson, tempPost)
Dim com As String = post.balance
TextBox3.Text = com
textbox2 contains following values
{"balance":{"balance":"3.63","currency":"USD","loginid":""},"echo_req":{"balance":1},"msg_type":"balance"}
but textbox3 doesn't return any value.
please help me to parse the balance amount i.e 3.63 in textbox3
Comments
post.balance
will give you{"balance":"3.63","currency":"USD","loginid":""}
to get 3.63 you need to dopost.balance.balance
it shows the following error
post.balance is actually not returning anything to me but you have said it has to return
{"balance":"3.63","currency":"USD","loginid":""} but it is not returning anything on textbox3
@mahendran1992 your
post
is json object, hence you can do thispost.balance
to accessbalance
key, but you are assigningpost.balance
to stringDim com As String = post.balance
hence you can not docom.balance
so better convertpost.balance
to json object and then you can get balance from iti have pasted my full code snippet
please find the error or give me any example program to parse the balance in Visual basic 2013