Convert JSon data string to readable data

eatraas

Registered User.
Local time
Today, 07:01
Joined
Jan 23, 2009
Messages
96
Hi,

thos is f.i. a json data sting :

{"vip_kaarten":"0","reg_kaarten":"0","extra_vip_kaarten":"0","bedrag_extra_vip_kaarten":"0.00","extra_reg_kaarten":"0","bedrag_extra_reg_kaarten":"0.00","vrjr_kaarten":"2","extra_vrjr_kaarten":"0","bedrag_extra_vrjr_kaarten":"0.00","website_link_sponsorpagina":"1","website_banner":"","social_extra_mededelingen":""}

How can i convert this to readle data?

First string is the field name, second the value.

Regards
Erwin
 
One simple idea comes to my mind is using a (minimum of two) Split function(s), but what you wish to do with the data and how you will manipulate is the second question.

PS: Just did a very quick Google search, there are several hits on the topic, there seems to be even a Object in VB that can parse JSON String. Do a Google search.
 
Hi,

thanks. I dit a google search and there was one good solution but this involed a certain library , which was not to be found... so ..
 
this code i found, looks like this :

PHP:
Sub TestJsonDecode() 'This works, uses vba-json library 
    Dim lib As New JSONLib 'Instantiate JSON class object 
    Dim jsonParsedObj As Object 'Not needed 

    jsonString = "{'key1':'val1','key2':'val2'}" 
    Set jsonParsedObj = lib.parse(CStr(jsonString)) 

    For Each keyName In jsonParsedObj.keys 
        MsgBox "Keyname=" & keyName & "//Value=" & jsonParsedObj(keyName) 
    Next 

    Set jsonParsedObj = Nothing 
    Set lib = Nothing 
End Sub 

Sub TestJsonEncode() 'This works, uses vba-json library 
    Dim lib As New JSONLib 'Instantiate JSON class object 
    Set arr = CreateObject("Scripting.Dictionary") 

    arr("key1") = "val1" 
    arr("key2") = "val2" 

    MsgBox lib.toString(arr) 
End Sub

But where is the jlib ....
 

Users who are viewing this thread

Back
Top Bottom